I need a fluid layout that has a fixed right column, I have tried using this as a guide but I can't get it to work as I'd like.
The problem is that the main image doesn't fill 100% of it's container (100%, minus the 300px for the sidebar). I also need it to maintain a fixed gutter between the two (30px)
HTML:
<div class="imagecol portrait">
<div class="mainimg">
<img class="product_image" id="product_image_15" alt="Test Product" title="Test Product" src="http://example.com/main.jpg">
</div>
<div class="products_list clearfix related-products">
<div class="product">
<img src="http://example.com/200x200.jpg" title="Product 01" alt="Product 01">
<p>Product 01</p>
</div>
<div class="product">
<img src="http://example.com/200x200.jpg" title="Product 03" alt="Product 03">
</div>
<div class="product">
<img src="http://example.com/200x200.jpg" title="Test Product" alt="Test Product">
</div>
</div>
</div>
Some CSS:
.single_product_display .imagecol{
width:77%;
float:right;
margin:0;
}
.imagecol .mainimg{
width:100%;
float:left;
}
.imagecol .product_image{
margin-right: 330px;
cursor:default !important;
}
.imagecol.portrait .products_list{
margin: 0px 0 0 -330px;
float: left;
width: 300px;
}
.imagecol .products_list .product{
margin:0 5px 5px 0;
width: 145px;
height: auto;
}
I managed to work it out, the problem was that the <img>
didn't expand in the same way that the <div>
did in the tutorial (http://www.dynamicdrive.com/style/layouts/category/C13/). the solution involved wrapping the main image in another <div>
So the HTML became this:
<div class="imagecol portrait">
<div class="imagecolwrapper">
<div class="mainimg">
<img class="product_image" id="product_image_15" alt="Test Product" title="Test Product" src="http://65.39.128.45/~jpretty/wp-content/uploads/2013/03/url.jpg">
</div>
</div>
<div class="products_list clearfix related-products">
<div class="product">
<img src="http://65.39.128.45/~jpretty/wp-content/uploads/2013/03/YugoslavianCamo-200x200.jpg" title="Product 01" alt="Product 01">
<p>Product 01</p>
</div>
<div class="product">
<img src="http://65.39.128.45/~jpretty/wp-content/uploads/2013/03/animals-2-200x200.jpg" title="Product 03" alt="Product 03">
</div>
<div class="product">
<img src="http://65.39.128.45/~jpretty/wp-content/uploads/2013/03/url-200x200.jpg" title="Test Product" alt="Test Product">
</div>
</div>
</div>
And the CSS became this:
.single_product_display .imagecol{
width:77%;
float:right;
margin:0;
}
.imagecol .imagecolwrapper{
width:100%;
float:left;
}
.imagecol .mainimg{
margin-right: 330px;
}
.imagecol .product_image{
width:100%;
cursor:default !important;
}
.imagecol.portrait .products_list{
margin: 0px 0 0 -300px;
float: left;
width: 300px;
}