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

Man. Flexbox is one of those things that makes me excited to do front end stuff again. And I love that Mozilla is making better and better tools.


Have a look at CSS grids and get prepared to drop your jaw.

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_La...


In practice, almost everything that you ever want to achieve with Grid can be achieved with Flexbox. Time and time again, I’ve encountered examples of “what Grid enables”, and been able to replicate it precisely with Flexbox.

Not always—there are definitely practical things you can achieve with Grid that you can’t with previous layout options, I’ve made a couple myself—but almost always.


Interesting, having used them both a lot I feel exactly the opposite way – I think grid's capabilities apply to more situations and suspect it will be the go-to layout/alignment tool once it catches on more. Grid is the more powerful tool, I think the only feature it can't do that flexbox does is making wrapped items not line up (since grid, of course, wants to make them line up into a grid). Wanting items not to line up seems less common, doesn't it?


Flex is about single-dimensional layout, grid is about two-dimensional layout.

Most layout scenarios that are in two dimensions can actually be solved with nested single-dimensional layout. Sometimes it’ll be easier to solve them with a proper two-dimensional layout, and I tend to prefer the markup that Grid lets me have, but I find two-dimensional layout that can’t be solved with nested single-dimensional layout to be uncommon.

Also, most interface problems are actually single-dimensional.

I think Grid will become more popular than it is, but never overtake Flexbox as most people’s go-to for layout, because Flexbox is normally enough, and Grid is too complex. I use it from time to time, and I have taken the trouble to know exactly what it’s capable of, so that I know when I should reach for it rather than Flexbox or something else or giving up, but I normally need to look up various properties when I go to use it. Meanwhile, most of what people want to achieve with Flexbox is just `display: flex;` plus `flex-direction`, `flex`, `align-items` and `justify-content`, and there are few enough knobs that you can essentially brute-force it without trouble—and the Flexbox Inspector makes it even easier, in a way that the Grid Inspector can’t really because Grid is just too powerful.


grid-gap is annoying to replicate/hack in flexbox. Although the column-reverse/row-reverse feature in flexbox is awesome.

Two big things in grid come to mind that make me use it much more than flexbox: grid-template-areas, and being able to overlap cells using lines.

In general, having a flexible first-class 2d layout is much easier to work with and change later than having nested 1d layouts.


Flexbox is awesome.

Flexbox will also have you scratching your head and randomly changing css values because your layout is completely messed up and you have no idea why.




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: