Item loop first last div

daydreamer

UPDATE: only works on first row of 3 divs not more :?

daydreamer

Solved with this

#loop {
background-color: #F1F1F1;
padding: 20px;
margin-bottom: 40px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
#loop:first-of-type {
margin-left: 0;
}
#loop:last-child {
margin-right: 0;


<div id="loop"class="four columns">
<a href="[LINK]">[TITLE]</a>
[THUMB]
<p>[DESCRIPTION]</p>
</div>

daydreamer

The problem I have is I'm using skeleton responsive and my looped items are in a four column div

The first would need alpha
and the last would need omega so it doesn't work with css first-child last-child

daydreamer

Could you show me an example please

daydreamer


freeSbee

Hi daydramer

Use CSS selectors like :first-child and :last-child.

Regards Christoph

daydreamer

#1
On the item loop I need the first and last divs to have a class of first & last. so the fist div has margin-left 0 and last div has margin-right 0. How can this be done?