I needed to create a style that targeted every 3rd item in a list of items. Instead of creating all these as individual css lines I used the following in Compass

@for !n from 1 to 100
      @if (!n % 3 == 0)
        .field-item-#{!n}
          :margin-right 0

which resulted in:
.field-item-3 { margin-right: 0; }
.field-item-6 { margin-right: 0; }
.field-item-9 { margin-right: 0; }
.field-item-12 { margin-right: 0; }
.field-item-15 { margin-right: 0; }
.field-item-18 { margin-right: 0; }
.field-item-21 { margin-right: 0; }
.field-item-24 { margin-right: 0; }
.field-item-27 { margin-right: 0; }

Add your comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.