I have a grid layout.
Now I want the .left
element to span across the entire column like this:
But I tried to make it grid-row: auto / -1;
and it does not seem to work.
I can't change the html structure nor hard code it to grid-row: auto / span xx
since the number of the elements is not certain.
How do I make the first element always span the entire column?
section {
counter-reset: spans;
display: grid;
grid-template-columns: 80px repeat(auto-fill, minmax(160px, 1fr));
gap: 4px;
}
section span {
counter-increment: spans;
border: solid 1px #aaa;
}
section span::before {
content: counter(spans);
}
.left {
grid-row: auto / -1;
}
<section>
<span class="left"></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</section>