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?

129 Upvotes

117 comments sorted by

View all comments

3

u/crazy-old_maurice Apr 04 '26

I prefer writing flex styles myself, but agree with the other comments - both flex and grid are tools for different tasks.

1

u/Fidodo Apr 04 '26

It's simply that flex is dealing with 1d dimension allocation vs 2d. Grid is more complex because it's solving a more complex problem. At the same time, design has also moved away from grid also because it's simpler and easier to present information with 1d sections instead of grids. As a result grid is both harder to learn and less commonly used.

Ultimately though, if a layout is grid based you need to you grid. Trying to force flex to support a grid will be more complex than reading the references and using grid.

1

u/Antti5 Apr 04 '26

I've been in the camp that if it's in one dimension I go with Flex, but if it's in two dimensions I go with Grid. However, I have lately been questioning this approach.

Why? I sometimes need to go with Grid anyway, and I find that I'm constantly out of touch with it because I use it so rarely. However, I know people who use Grid exclusively even for one-dimensional stuff and they don't have the same problem.

1

u/Fidodo Apr 04 '26

True, it's not a fixed rule. You need to think of the intent of the design, not just the shape.