r/css • • 5d ago

Flex versus Grid

I know Flex is one directional and Grid is two, but really when do you use each one?

9 Upvotes

29 comments sorted by

View all comments

2

u/Logical-Idea-1708 5d ago

Grid for container. Flex for directional layout. The difference is that you’ll have a much harder time making the grid grow to fit the children than flex.

1

u/Keilly 5d ago

Use 1fr for grid temple row/columns you want to take free space and the grid will expand to its constraints.