Grid-Based Split Screens
You'll learn how to create perfect 50/50 split-screen layouts using CSS Grid's fractional units.
What Is a Split Screen Layout?
A split screen divides your viewport into two equal (or nearly equal) sections — often used for hero sections, side-by-side comparisons, or image-and-text combinations. With CSS Grid, you can achieve this elegantly in just a few lines of code.
Creating a 50/50 Split with fr Units
The key is using two 1fr columns, which divide the available space equally:
.split-container {
display: grid;
grid-template-columns: 1fr 1fr;
min-height: 100vh; /* Full viewport height */
}
<div class="split-container">
<div class="left-panel">Content here</div>
<div class="right-panel">Content here</div>
</div>
Each panel automatically takes up exactly half the width, no matter the screen size.
Common Variations
Unequal splits work just as easily:
grid-template-columns: 2fr 1fr; /* Left takes 2/3, right takes 1/3 */
Full-height hero sections combine min-height: 100vh with centered content inside each panel.
Gap between panels:
gap: 2rem; /* Adds breathing room */
Why Grid Wins Here
Unlike Flexbox's flex: 1 approach, Grid gives you explicit control over track sizing, makes gaps simpler, and naturally handles both horizontal and vertical splits with the same mental model.
Key Takeaway: Use grid-template-columns: 1fr 1fr to create perfect 50/50 split-screen layouts — change the ratio by adjusting the fr values for any proportion you need.