I've noticed that when I use column-count: 3 in my code and I have 7 items for example. The first two columns will have 3 elements each and the third column will have only one element (see picture for example).
Is this the normal behavior of column-count, or should column-count be filling all column equally?
UPDATED-
I tried messing around with caiovisk answer and I changed the code from li elements to divs since that is what I am working with.
That seems to work great but in my situation sometimes elements might be bigger than others causing gaps (see the picture below). How do you fix this issue using the flex method?
.columns-3 {
flex-basis: calc(33.33% - 20px);
margin: 10px;
}
.redBox {
height: 50px;
background-color: red;
}
.bigger {
height: 150px;
}
<div class="columns">
<div class="columns-3 redBox bigger"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox bigger"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox bigger"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
<div class="columns-3 redBox"></div>
</div>