Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did this and enjoyed it.

Maybe I'm getting old but I just use flexbox every time. Makes me very "meh" about CSS grid.



Flexbox is simpler and covers most use cases. No need to go grid unless there is a special need.


> Flexbox is simpler and covers most use cases.

CSS Grid was the first specification for page layout using rows and columns (grids) since the creation of the web. Everything else prior was a compromise.

Flexbox is for laying out rows or columns; while you can do some limited page layout, that's not what it's designed for. Just like tables and floats weren't designed for page layout either.

Another way to grok this: CSS Grid is for two dimensional layout and Flexbox is for one dimensional layout.

Flexbox and CSS Grid were designed to work together, each doing what it was designed to do.


Flexbox generally tends to be great for a single row/column layout, grid excels at multicolumn/row (especially considering subgrid)

One of the most useful features of grid that replaces flexbox, in my experience, is auto-fit and auto-fill, which are great for "card" style layouts. You can use flexbox for these, but the treatment of wrapping items in non-full rows was always a point of frustration for me. This is even better if you can utilize subgrid to align the card contents.

https://css-tricks.com/auto-sizing-columns-css-grid-auto-fil...


Grid definitely requires a bit more up-front thinking. With flexbox, you can code and then change in stream-of-consciousness coding.


Maybe I'm getting old but I just use HTML tables every time. :-D


>Maybe I'm getting old but I just use flexbox every time. Makes me very "meh" about CSS grid.

Grid is the wrong choice 99% of the time, but 1% of the time it will save you a ton of effort. Fixed navbars come to mind.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: