I've got some divs, all floated left, the first of which is three times wider and a bit shorter than the rest. When the smaller divs wrap and break onto the next "line", I'd like the first three of the smaller divs to lie flush against the bottom of the larger one. (A bit tricky to describe in text, but the fiddle will give you the idea.)
How do I make this happen?
Markup:
<div class="bigger"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
<div class="smaller"></div>
Style:
.bigger {
height: 40px;
width: 308px;
margin: 0 4px 4px 0;
background: red;
float: left;
}
.smaller {
height: 60px;
width: 100px;
margin: 0 4px 4px 0;
background: blue;
float: left;
}
The three left-most blue divs in the fiddle should line up against the red one according to their margins (4px bottom margin on the red div)
For the record, it looks like pinterest accomplished their staggered float-like layout by using a script to assign absolute positions to each div, which is something I'd rather not do.