I am using twitter bootstrap to make 2 divs placed side-by-side. Each div has medium and large images inside it, arranged using jquery isotope. The problem is that when there are not enough images in a div, the div width remains same and there's a lot of extra space left. Like this :
I want the divs to align centrally and also reduce in width to fit the images inside it. Like this:
My HTML code is this :
<div id="container" class="container-fluid">
<div class="row-fluid">
<div class="legend span8">Section1</div>
<div class="legend span4">Section2</div>
</div>
<div class="row-fluid">
<div id="section1" class="span8">
<div class="small"><img src="images/1.jpg" /></div>
<div class="small"><img src="images/2.jpg" /></div>
<div class="big"><img src="images/3.jpg" /></div>
</div>
<div id="section2" class="span4">
<div class="small"><img src="images/1.jpg" /></div>
<div class="small"><img src="images/2.jpg" /></div>
<div class="big"><img src="images/3.jpg" /></div>
</div>
</div>
</div>
My CSS looks like this :
#section1 .small{
width:150px;
height:200px;
overflow:hidden;
}
#section1 .big{
width:320px;
height:420px;
overflow:hidden;
}
#section2 .small{
width:80px;
height:100px;
overflow:hidden;
}
#section2 .big{
width:170px;
height:220px;
overflow:hidden;
}
Other styles are bootstrap's.