Hi guys I could not find any helping examples since I have never used CSS grids, anyways how would I fill the empty space in the grid with next element? My 1fr
element does not fit in the previous space that is available. Is it due to that I'm doubling the height of the class or what?
Like I've said I have never used CSS grids but I only need them now and this is the last thing I would add to the code, could you guys help me out?
#container {
width: 40%;
margin-left: 20%;
margin-bottom: 1rem;
display: grid;
float: left;
grid-template-columns: auto;
}
#container>div:nth-child(1) {
margin-top: 0 !important;
}
.content-1x,
.content-2x,
.content-3x {
margin: 1rem 1rem 0 0;
height: 15rem;
border-bottom: 1px solid #ddd;
border-right: 1px solid #ddd;
}
.double-height {
height: 30rem;
}
.content-3x {
grid-area: auto / auto / auto / span 3;
}
.content-2x {
grid-area: auto / auto / auto / span 2;
}
.content-1x {
grid-area: auto / auto / auto / span 1;
}
<div id="container">
<div class="content-3x">
3
</div>
<div class="content-2x double-height">
4
</div>
<div class="content-1x">
5
</div>
<div class="content-1x">
5
</div>
<div class="content-2x">
4
</div>
<div class="content-1x">
5
</div>
<div class="content-2x">
4
</div>
<div class="content-3x">
6
</div>
<div class="content-2x">
7
</div>
<div class="content-1x">
8
</div>
<div class="content-1x">
9
</div>
<div class="content-2x">
10
</div>
</div>
Is there any easy way to do this without using media queries or sth like that?