.wrapper {
width: 500px;
border: 5px solid pink;
display: grid;
grid-template-columns: max-content
repeat(auto-fit, minmax(70px, 1fr));
grid-auto-columns: 1fr;
}
.wrapper > *:nth-child(1) {
background-color: purple;
width: 200px;
}
.wrapper > *:nth-child(2) {
background-color: orange;
}
<div class="wrapper">
<div class="box a">A</div>
<div class="box b">B</div>
</div>
GC = Grid-container. GI = grid-item.
I'd like for my 2nd GI to fill up the remaining space in row1. However, when the space left for the 2nd GI on row1 reaches below 70px, I want it to start it to wrap to a new implicit row below - the width of which spans the container (1fr).
When this 2nd GI gets put on a new row, I'd like to make CSS changes to it. Is there anyway to 'look out' for this?