CSS grid-auto-flow

The grid-auto-flow property in CSS specifies how the auto-placement algorithm works, specifying how the items are automatically placed in the grid container.

There are four possible values for the grid-auto-flow property:

Let's see some examples using fictional data:

Result:

    .grid-container {
      display: grid;
      grid-template-columns: 50px 50px 50px;
      grid-auto-flow: row;
    }
  
1
2
3
Result:

    .grid-container {
      display: grid;
      grid-template-columns: 50px 50px 50px;
      grid-auto-flow: column;
    }
  
1
2
3
4
5
6

These are just basic examples to show how the grid-auto-flow property works. You can explore more complex grid layouts by experimenting with different values and grid configurations.