How is this possible
HTML
<div id="container"> <div class="box">box 1</div> <div class="box">box 2</div> <div class="box last">box 3</div> <div class="clear"></div> <div class="box">box 4</div> <div class="box">box 5</div> <div class="box last">box 6</div> </div>
CSS
#container {width: 90%;} .box {float: left; display: block; background: #c00; color: #fff; text-align: center; width: 30%; margin: 0 5% 5% 0;} .box.last {margin: 0 0 5% 0;} .clear {clear: both;}
The only problem you may encounter is that they are square, as width is a variable that you cannot set in CSS. Some jQuery may be required to provide this. Something like this ... untested:
JQuery
$('.box').each(function(){ $(this).height($(this).width()); });
Matthew3man
source share