Easily Apply Styles to Every Other Element

A real quick snippet here!

Easily apply styles to every other element with CSS3’s handy :nth-child selector. Here’s a sass example below

li {
    &:nth-child(even) {
        background: lighten($black, 10%);
    }
    &:nth-child(odd) {
        background: lighten($black, 12%);
    }
}

See! Easy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.