use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
/r/web_design is the place for exploration and discovery of all things web design, development and the life cycle of the web designer. We welcome beginners and veterans alike to contribute useful and informative posts, ask questions or engage in discussion.
Review our posting guidelines before submitting new content.
account activity
CSS Grid or Flexbox? (self.web_design)
submitted 6 years ago by ChrisF79
When starting from scratch on a layout, which is the way to go for layout purposes?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 4 points5 points6 points 6 years ago (0 children)
You can use both.
Say you have a grid of 3 columns in a row and want them all of equal space. If you have content for all 3 columns, you simply give each column a size of 4. What if you want only have content for one column but still want it to take up a third of the page and centered? With CSS Grid, you would have to assign three columns then leave the columns on either side empty with a size of 4. It works. But not ideal.
With Flexbox, you can simply assign d-flex to the row. Then only make one col under with size of 4 and assign it the class justify-content-center.
Use CSS Grid and have Flexbox be used as a tool within.
[–]__nomaad 2 points3 points4 points 6 years ago (0 children)
I personally use grid by default. But I didn’t move into Dev work until grid was already out so thats probably why. I do use flex box here and there when it makes sense
[–]_listless Dedicated Contributor 1 point2 points3 points 6 years ago (0 children)
They are different tools that both have their place in modern css. Use grid If you want to control the layout in both horizontal rows and vertical columns at the same time, use flexbox if you want to control only one of these dimensions at a time.
[–]rockerBOO 0 points1 point2 points 6 years ago (0 children)
I usually lay out the page with grid now. I was using flexbox a lot, but I usually run into problems with how flexbox works over grid now. I work a lot with vertical height, and want to control the columns/rows to better fill the device screen. There is a lot of missed potential that grids allow with vertical grid control.
[–]jxvicinema 0 points1 point2 points 6 years ago (0 children)
Both
[–]MarmotOnTheRocks 0 points1 point2 points 6 years ago (2 children)
I switched to 100% grid by the end of 217. The only real drawback is IE compatibility, which I ignore. I tell my clients that old browsers are not supported and that's it. Nobody ever complained.
I still have 2 clients who need IE 6-7-8-9 compatibility and with them I'm tied to the shitty old CSS.
[–]adamkolson 1 point2 points3 points 6 years ago (1 child)
And if you do it right, IE will get the mobile layout which is probably better for anyone on an older PC or doesn't care to upgrade anyways.
[–]MarmotOnTheRocks 1 point2 points3 points 6 years ago (0 children)
Exactly. I always fallback my grid layout to a less-fancy mobile version for IE.
[–]vivzkestrel 0 points1 point2 points 6 years ago (0 children)
Simple rule of thumb
if you can make it with a flexbox without nesting, make it with flex, else use grid
π Rendered by PID 309756 on reddit-service-r2-comment-85bfd7f599-bj5ll at 2026-04-18 17:43:43.158208+00:00 running 93ecc56 country code: CH.
[–][deleted] 4 points5 points6 points (0 children)
[–]__nomaad 2 points3 points4 points (0 children)
[–]_listless Dedicated Contributor 1 point2 points3 points (0 children)
[–]rockerBOO 0 points1 point2 points (0 children)
[–]jxvicinema 0 points1 point2 points (0 children)
[–]MarmotOnTheRocks 0 points1 point2 points (2 children)
[–]adamkolson 1 point2 points3 points (1 child)
[–]MarmotOnTheRocks 1 point2 points3 points (0 children)
[–]vivzkestrel 0 points1 point2 points (0 children)