Split Screen Layout
What you'll learn: How to build clean 50-50 split screen designs using flexbox, perfect for landing pages with image-text pairings or sidebar layouts.
Why Split Screens Work
A split screen divides your viewport into two equal halves, creating a balanced, modern look. Think of it like opening a book — two pages side by side, each telling part of the story. This pattern is especially popular for hero sections where you want an image on one side and compelling copy on the other.
The Flexbox Approach
Since you're already comfortable with flexbox properties, creating a split screen is straightforward:
.split-container {
display: flex;
height: 100vh; /* Full viewport height */
}
.split-left,
.split-right {
flex: 1; /* Each takes equal space (flex-grow: 1) */
}
<div class="split-container">
<div class="split-left">
<!-- Image or content -->
</div>
<div class="split-right">
<!-- Text or content -->
</div>
</div>
Making It Responsive
For mobile screens, change flex-direction to stack the halves vertically:
@media (max-width: 768px) {
.split-container {
flex-direction: column;
}
}
Adding Visual Interest
You can center content within each split using nested flexbox, add background images, or adjust alignment:
.split-left {
background: url('hero.jpg') center/cover;
}
.split-right {
display: flex;
align-items: center; /* Vertical center */
justify-content: center; /* Horizontal center */
padding: 2rem;
}
Key Takeaway: Split screen layouts use flex: 1 on child items to create equal halves, combined with height: 100vh for full-screen impact — all controlled by the flex container's direction and your items' flexibility properties.