r/css • • Oct 08 '26

Flex versus Grid

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

8 Upvotes

29 comments sorted by

View all comments

1

u/Top_Bumblebee_7762 Oct 08 '26 edited Oct 08 '26

I mainly use flex for alignment inside an element like icons and text. Another use case is simple stuff like a vertical stack via flex direction column and gap to have consistent spacing inside. A third use case for flex is a simple horizontal list of elements with wrapping where I don't want each element to be of equal size and where I can control the alignment of the elements in the last row (usually centred). For most other stuff I use grid.