I'm dealing with 6 elements that I want to display in two rows of 3 each by floating them. However, the content of each element varies in height, causing layout issues when a taller element disrupts the float of its siblings:
Check out this example CSS:
figure { width: 30%; float: left; margin-left: 1%; font-size: small; outline: solid #999 1px; }
img { max-width: 100%; }
and HTML:
<figure>
<img src="http://placekitten.com/150/200?image=1" alt="Kitten 1" />
<figcaption>Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint repellendus mollitia distinctio voluptates vitae atque vel soluta libero...</figcaption>
</figure>
... (repeat for kittens 2-6)
Here's a link to a JSFiddle with the issue: http://jsfiddle.net/KatieK/5Upbt/
Any ideas on how to ensure the second row of figure
elements align properly below the first 3?
I'm looking for HTML/CSS solutions over JavaScript/jQuery fixes.