I have my grid layout with grid-template-columns: auto auto auto;
meaning one row should have maximum 3 columns. So far so good, the next I want to achieve though is that when there is only a single (or two) column inside a row, I want it to fill the rest of the row, leaving no space behind.
.grids {
display: grid;
grid-template-columns: auto auto auto;
}
.red {
background-color: red;
}
.blue {
background-color: blue;
}
.yellow {
background-color: yellow;
}
<div class="grids">
<div class="red">s</div>
<div class="blue">s</div>
<div class="yellow">s</div>
<div class="yellow">a</div>
</div>