I am dealing with a situation where I have several boxes or blocks arranged in a 3-column layout. These boxes are styled using properties like float: left, width: 33%
, but they have varying heights.
Is there a way to make sure that the boxes always fill in the empty spaces between rows of columns (for example, ensuring Panel 4 is right under Panel 1 without any gaps)?
For instance:
<style>
.testpanel { width: 33%; border: 1px solid black; float:left;}
</style>
<div class="testpanel">
Panel 1
</div>
<div class="testpanel">
Long Panel 1
<br /><br /><br />
</div>
<div class="testpanel">
Long Panel 2
<br /><br /><br />
</div>
<div class="testpanel">
Panel 4
</div>
Currently, there is always a visible gap between Panel 1 and Panel 4 that I wish to eliminate. Is it possible to achieve this using only CSS without resorting to JavaScript libraries like ?
While I know how to address this issue in a fixed layout by populating content per column, my challenge lies in dynamically generating or deleting panels without being restricted to a specific column.
Bootstrap version: http://jsfiddle.net/WhKLj/1/