The grid-auto-flow CSS property controls how the auto-placement algorithm works, specifying exactly how auto-placed items get flowed into the grid.

Initial value row
Applies to grid containers


grid-auto-flow: column;


Items are placed by filling each row in turn, adding new rows as necessary. If neither row nor column is provided, row is assumed.
Items are placed by filling each column in turn, adding new columns as necessary.
"dense" packing algorithm attempts to fill in holes earlier in the grid, if smaller items come up later. This may cause items to appear out-of-order, when doing so would fill in holes left by larger items.

Browser support


We use cookies to improve your experience. Learn more in our Privacy policy.