← Back toCSS Layout

Simple grid

Written byPhuoc Nguyen
22 Nov, 2019


<!-- Row -->
<div class="simple-grid">
<!--Cell with given width. Replace 25% with whatever you want -->
<div class="simple-grid__cell simple-grid__cell--1/4">25%</div>

<!-- Cell that takes remaining width -->
<div class="simple-grid__cell simple-grid__cell--fill">...</div>


.simple-grid {
display: flex;

margin-left: -0.25rem;
margin-right: -0.25rem;

.simple-grid__cell {
padding-left: 0.25rem;
padding-right: 0.25rem;

.simple-grid__cell--fill {
flex: 1;

/* Cell with given width */
.simple-grid__cell--1\/2 {
flex: 0 0 50%;
.simple-grid__cell--1\/3 {
flex: 0 0 33.3333333%;
.simple-grid__cell--1\/4 {
flex: 0 0 25%;

Questions? 🙋

Do you have any questions? Not just about this specific post, but about any topic in front-end development that you'd like to learn more about? If so, feel free to send me a message on Twitter or send me an email. You can find them at the bottom of this page.
I have a long list of upcoming posts, but your questions or ideas for the next one will be my top priority. Let's learn together! Sharing knowledge is the best way to grow 🥷.

Recent posts ⚡

Newsletter 🔔

If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn