I am trying to use column-count
css property to render div
s in 4 columns.
But when there are 3n items (3, 6, 9...) in columns wrapper, only three columns get filled, and fourth column is empty!
CSS:
.columns {
-webkit-column-count: 4; /* Chrome, Safari, Opera */
-moz-column-count: 4; /* Firefox */
column-count: 4;
}
.item {
display: inline-block;
widtth: 100%;
border: 1px solid red;
}
HTML:
<div class="columns">
<div class="item">Lorem ipsum dolor sit amet 1</div><div class="item">Lorem ipsum dolor sit amet 2</div><div class="item">Lorem ipsum dolor sit amet 3</div>
<div class="item">Lorem ipsum dolor sit amet 4</div><div class="item">Lorem ipsum dolor sit amet 5</div><div class="item">Lorem ipsum dolor sit amet 6</div>
<div class="item">Lorem ipsum dolor sit amet 7</div><div class="item">Lorem ipsum dolor sit amet 8</div><div class="item">Lorem ipsum dolor sit amet 8</div>
</div>
Here is a JSFiddle.
How do I get elements in all 4 columns?