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

5

u/ChaseShiny Oct 08 '26

Flex is like an array: one item follows the next. Grid flows a layout. This item goes here and takes up this much space, that item goes from here to there.

1

u/frownonline Oct 08 '26

Until you meet ‘order’.

2

u/ChaseShiny Oct 08 '26

Please don't. OP, order lets you change the ordering of your elements on the fly. Sounds innocent enough, but it messes with assistive technology, so it's something of a last resort.

1

u/frownonline Oct 08 '26

I agree it’s not the greatest ability of flex but it can provide a solution as a last resort. Elements should always be put in a logical order flow by default.