I have 12 children div
s in my .wrapper
element that I'd like to stack next to each other. The number 12 is actually dynamic so I have no idea how many children I'll have. Right now my grid layout looks like this:
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: auto auto;
grid-auto-flow: column dense;
grid-gap: 10px;
}
This is fine until the grid should start wrapping the elements (the layout is full, the grid is 3x2 which holds 6 elements). The seventh, eigth and all of the rest are stacked next to the first six, although I would want them to be in a new line with the same template (so essentially my grid would become 2x(3x2)).
The explanation probably doesn't make too much sense on its own, check out the Codepen as well.
How do I make the elements after the sixth one wrap into a new line?