{"id":367122,"date":"2022-07-27T07:56:45","date_gmt":"2022-07-27T14:56:45","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=367122"},"modified":"2022-07-27T07:56:46","modified_gmt":"2022-07-27T14:56:46","slug":"grid-auto-flow","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/g\/grid-auto-flow\/","title":{"rendered":"grid-auto-flow"},"content":{"rendered":"\n

The grid-auto-flow<\/code> CSS property is part of the CSS Grid Layout specification<\/a> that allows us to control the flow of grid items that are automatically placed when they are not explicitly positioned with any grid-placement properties.<\/p>\n\n\n\n

.grid-container {\n  display: grid;\n  grid-template-columns: repeat(8, 50px);\n  grid-auto-flow: dense;\n}<\/code><\/pre>\n\n\n\n

That example creates a grid container that can hold eight items in each row and fills any remaining available space with smaller items that come later and can fit the space.<\/p>\n\n\n\n\n\n\n\n

\"\"
Demonstrating the effect of grid-auto-flow: dense<\/code> in a grid layout.<\/figcaption><\/figure>\n\n\n

Syntax<\/h3>\n\n\n
grid-auto-flow: [ row | column ] || dense<\/code><\/pre>\n\n\n\n