How to create: split screen (1/2)
Learn how to use CSS to create a split screen (50/50) effect.
How to create split screen
First step - Add HTML:
<div class="split left"> <div class="centered"> <img src="img_avatar2.png" alt="Avatar woman"> <h2>Jane Flex</h2> <p>Some text.</p> </div> </div> <div class="split right"> <div class="centered"> <img src="img_avatar.png" alt="Avatar man"> <h2>Bill Gates</h2> <p>Some text here too.</p> </div> </div>
Second step - Add CSS:
/* Split the screen in half */ .split { height: 100%; width: 50%; position: fixed; z-index: 1; top: 0; overflow-x: hidden; padding-top: 20px; } /* Control the left side */ .left { left: 0; background-color: #111; } /* Control the right side */ .right { right: 0; background-color: red; } /* Kung gusto mong itakda ang nilalaman na naka sentro sa both horizontal at vertical directions */ .centered { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; } /* Kung kailangan, itakda ang estilo ng larawan sa gitna ng konteyner */ .centered img { width: 150px; border-radius: 50%; }