This CSS Grid layout includes some items that are marked as "featured." They take up the full grid width. You can see that they are dropped down to the next row because they're too big for the available slot. The next item in the grid then moves up to take the space the featured item would have taken if it were the normal size. The numbers show the item's order in the DOM.
This is all accomplished using the grid-auto-flow property. The default value is to lay things out in rows using the next available space that fits the item. Click "Default" below to see the default layout.
The "dense" value allows you to fill in the gaps, so to speak, with the next available item that will fit. You'll see that this takes things out of their DOM order and visually reorders the grid. Click the "Dense" button to see this happen.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15