I have multiple div elements with unknown specified heights. I am looking to create a responsive design by organizing them into 1 to 4 rows.
<div id="timeline">
<div class="entry" style="height: (any height e.g. 222px)">
<div class="background"></div>
<div class="image"></div>
<div class="entrytext">sometext</div>
</div>
<div class="entry" style="height: (any height e.g. 174px)">
<div class="background"></div>
<div class="image"></div>
<div class="entrytext">sometext</div>
</div>
.
.
.
</div>
View the example on jsFiddle
Attempted solutions:
.entry { display: inline-block }
Issue: excessive unused space due to varying heights
.entry { float: left }
Issue: similar problem as with display:inline-block
#timeline { column-count: n (e.g 3) }
Issue: sorting from top to bottom instead of left to right
How can I arrange them in a horizontal order from left to right?
1 row:
1
2
3
.
.
2 rows:
1 2
3 4
5 6
.
.
3 rows:
1 2 3
4 5 6
7 8 9
.
.
.
4 rows:
01 02 03 04
05 06 07 08
09 10 11 12
.
.