Laying out 4 products when 4th product has a different CSS Class

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 18, 2012   (RSS)

By benedict - April 17, 2012

Hi guys,

I run into this problem a bit and just wanted to seek a definitive answer on the best way to lay it out.

I have 4 images I am laying out horizontally using an unordered list. What usually happens is that I have a style for the first 3 products (.product) and then a different style for the last product as the margin/padding is different (.product last).

How do I apply this in two instances:

a) using a multi-record section with a single image per record.
b) using a single record section with multiple images in an upload field.

These two snippets will save me work - I'm currently using offset, which seems a bit laborious...

Here is the original HTML:

<ul class="clearfix">
<li class="product">
<a href="product.html" class="thumb"><img src="images/products/product-1.jpg" alt="" /></a>
<a href="product.html" class="title">Product1</a>
<div class="clearfix info">
<a href="#" class="add-to-cart">READ MORE</a>
</div>
</li>

<li class="product">
<a href="product.html" class="thumb"><img src="images/products/product-2.jpg" alt="" /></a>
<a href="product.html" class="title">Product2</a>
<div class="clearfix info">
<a href="#" class="add-to-cart">READ MORE</a>
</div>
</li>

<li class="product">
<a href="product.html" class="thumb"><img src="images/products/product-3.jpg" alt="" /></a>
<a href="product.html" class="title">Product3</a>
<div class="clearfix info">
<a href="#" class="add-to-cart">READ MORE</a>
</div>
</li>

<li class="product last">
<a href="product.html" class="thumb"><img src="images/products/product-4.jpg" alt="" /></a>
<a href="product.html" class="title">Product4</a>
<div class="clearfix info">
<a href="#" class="add-to-cart">READ MORE</a>
</div>
</li>
</ul>