CSS grid-auto-flow Property
Example
Insert auto-placed items column by column:
.grid-container {
display: grid;
grid-auto-flow:
column;
}
Try it Yourself »
Definition and Usage
The grid-auto-flow
property controls how auto-placed items get inserted in the grid.
Default value: | row |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS Grid Layout Module Level 1 |
JavaScript syntax: | object.style.gridAutoFlow="row dense" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
grid-auto-flow | 57 | 16 | 52 | 10 | 44 |
CSS Syntax
grid-auto-flow:
row|column|dense|row dense|column dense;
Property Values
Value | Description | Play it |
---|---|---|
row | Default value. Places items by filling each row | Play it » |
column | Places items by filling each column | Play it » |
dense | Place items to fill any holes in the grid | Play it » |
row dense | Places items by filling each row, and fill any holes in the grid | Play it » |
column dense | Places items by filling each column, and fill any holes in the grid | Play it » |
More Examples
Example
Fill any holes in the grid by adding the "dense" value:
.grid-container {
display: grid;
grid-auto-flow: row
dense;
}
Try it Yourself »
Related Pages
CSS Tutorial: CSS Grid Layout