Pseudo element can help here. Resize the screen to see the result:
.grid-container {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 1fr;
border: 1px solid pink;
background-color: grey;
}
@media (min-width:800px) {
.grid-container {
grid-template-columns: 75%;
}
.grid-container::before {
content: "";
}
}
.grid-container :nth-child(odd) {
background-color: aqua;
}
.grid-container :nth-child(even) {
background-color: beige;
}
<div class="grid-container">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
<div class="grid-container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…