How can I achieve a layout consisting of two 4x2 grids that flow into each other, instead of being positioned side by side? Essentially, I want to split an 8x2 grid into two halves and stack them vertically. Is there a way to make the layout wrap around itself seamlessly?
Currently, my grid is set up as follows:
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(2, 1fr);
The child nodes are categorized into small, medium, and large classes:
.c-small { }
.c-medium {
grid-row: auto / span 2;
}
.c-large {
grid-column: auto / span 2;
grid-row: auto / span 2;
}
Is there a way to wrap the content from the top grid around to the bottom grid, instead of having it overflow to the right-hand side?
I'm not sure if this layout is achievable without JavaScript. Currently, I'm considering a solution where I manually move items from one grid to a second grid when they overflow, but I'm unsure how to detect when a grid item has overflowed into the implicit grid.
Check out the Codepen example here