Here's another, I found helpful. It works even for Responsive CSS design too.
#wrap
{
display: table;
table-layout: fixed; /* it'll enable the div to be responsive */
width: 100%; /* as display table will shrink the div to content-wide */
}
WARNING: But this theory won't work for holder contains inner elements with absolute positions. And it will create problem for fixed-width layout. But for responsive design, it's just excellent. :)
With CSS3, in a dynamic portion, you can add clear float to the last element by:
#wrap [class*='my-div-class']:last-of-type {
display: block;
clear: both;
}
Where your divs are:
<div id="wrap">
<?php for( $i = 0; $i < 3; $i++ ) {
<div class="my-div-class-<?php echo $i ?>>
<p>content</p>
</div> <!-- .my-div-class-<?php echo $i ?> -->
}
</div>
Reference: