I'm gonna have a grid that sometimes will have 1, 2, 3 or 4 columns.
Here is a example of 2 columns.
* {box-sizing: border-box;}
.wrapper {
border: 2px solid #f76707;
border-radius: 5px;
background-color: #fff4e6;
}
.wrapper > div {
border: 2px solid #ffa94d;
border-radius: 5px;
background-color: #ffd8a8;
padding: 1em;
color: #d9480f;
}
.wrapper {
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 10px;
grid-auto-rows: 50px 100px;
}
<div class="wrapper">
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
<div>Five</div>
<div>Six</div>
<div>Seven</div>
<div>Eight</div>
<div>Nine</div>
</div>
https://codepen.io/alfaex/pen/QWbPRxw
I want that in this case the ninth item span to the second column.
I can't find a property that says to the ninth item to 'just grow'
When the media query for the 3 columns kick in and change the
grid-template-columns: 1fr 1fr;
to grid-template-columns: 1fr 1fr 1fr;
it should occupy 1fr again
And the 1fr 1fr 1fr 1fr
share the same problem from the 1fr 1fr