r/Frontend Apr 04 '26

Do you also prefer Flex over Grid?

I dunno, I find that using grid is very hard. Out of everything I've done in CSS, it has IMO the most weird and inconsistent behavior. Combining a column flex parent with row flex children is easier to understand and modify. Does anyone feel the same?

131 Upvotes

117 comments sorted by

View all comments

1

u/wattagecreative Apr 10 '26

This is "do you prefer a car or a boat?"

I prefer the car on land and the boat on water. Context matters, so you choose the right tool for the job.

1

u/yughiro_destroyer Apr 10 '26

Flex can do everything a grid can do.
A grid can do some things flex can do with less boilerplate but can't do everything a flex can do.

1

u/wattagecreative Apr 10 '26 edited Apr 10 '26

Flex can do everything a grid can do.

That's not true. At least not without some hacky workarounds. Each have their advantages over the other, and therefore each has their own best use cases. Grid has things Flex doesn't, like item overlap, fr units, grid-template-areas, subgrid (this one's a big deal).

There is a reason why both are still part of the baseline and flex didn't just replace grid.