Skip to content

Auto-Flow & Placement Direction

When you don’t explicitly place items, Grid makes choices.

Those choices are governed by auto-placement — specifically grid-auto-flow.

This is the rulebook Grid uses to fill the grid.


grid-auto-flow: row;

This is the default behavior:

  • Fill rows left to right
  • Then create new rows as needed

It feels familiar — but it’s still Grid, not Flexbox.


grid-auto-flow: column;

Now Grid:

  • Fills top to bottom
  • Then creates new columns

Same items.
Same grid.
Very different outcome.


grid-auto-flow: row dense;

dense tells Grid to backfill gaps when possible.

This can:

  • Reduce empty space
  • Reorder items visually

Powerful — but potentially confusing if overused.


Change the flow direction.
Add gaps.
Watch Grid rethink placement.


Auto-placement is predictable — once you know the rules.

Control the flow,
or Grid will happily choose for you.


📘 Grid Auto Flow Study Guide (PDF)

📘 Grid Auto Flow Infographic (PNG)

Infographic explaining CSS Flexbox direction and axes, showing how flex-direction defines the main axis and cross axis, with visual examples for row, row-reverse, column, and column-reverse, and how justify-content and align-items map to each axis.

Counting lines, forwards and backwards, and spanning them too.