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'.

Quick example

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

Quick facts

Initial value
row
Inherited
No
Applies to
grid containers
Animation type
discrete

Values

rowcolumndense

grid-auto-flow Browser Support

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.

Safe to use without fallbacks.

57+
52+
10.1+
16+
ESC