grid-auto-flow

Determines the algorithm used to automatically place grid items that aren't specifically positioned. It can fill row by row, column by column, or try to fill gaps 'densely'.

It is documented as part of the CSS Grid Layout specification.

/* Usage Example */
.gallery {
  display: grid;
  /* Tells the browser to fill gaps when items vary in size */
  grid-auto-flow: dense;
}

/* Syntax */
grid-auto-flow: row;
grid-auto-flow: column;
grid-auto-flow: dense;

/* Global values */
grid-auto-flow: inherit;
grid-auto-flow: initial;
grid-auto-flow: revert;
grid-auto-flow: revert-layer;
grid-auto-flow: unset;
Widely available Since 2017 95% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2017.

57+
52+
10.1+
16+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC