I have 2 columns in my grid. All items have different heights, and when one cells is bigger than the one next to it, they get the same size. The actual content of the smaller cell, doesn't extend or stretch, but the cell gets bigger. Here is an example:
How can I prevent this? In this case I want the smaller (div one) cell to get size only as much as it needs so then div three can go up and don't leave huge gap between them.
* {box-sizing: border-box;}
.wrapper {
border: 2px solid #f76707;
background-color: #fff4e6;
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 10px;
}
.wrapper > div {
border: 2px solid #ffa94d;
background-color: #ffd8a8;
padding: 1em;
color: #d9480f;
}
.one {
height: 150px;
}
.two {
height: 200px;
}
<div class="wrapper">
<div class="one">One</div>
<div class="two">Two</div>
<div class="three">Three</div>
<div class="four">Four</div>
<div class="five">Five</div>
<div class="six">Six</div>
<div class="seven">Seven</div>
<div class="eight">Eight</div>
</div>