CSS :nth-child Equation

Posted by Meander365 on Stack Overflow See other posts from Stack Overflow or by Meander365
Published on 2011-02-28T07:22:21Z Indexed on 2011/02/28 7:24 UTC
Read the original article Hit count: 218

Filed under:
|

I have an unordered list and each li makes up one item in a two column layout:

col1    col2
1       2
3       4
5       6
7       8
9       10
11      12

I need to have an alternating background colour for each item BUT NOT so each item in one column is the same.

So :

1,4,5,8,9,11 will have one colour; and 2,3,6,7,10,12 will have another colour.

Can this be achieved with one :nth-child rule?

Thanks!

© Stack Overflow or respective owner

Related posts about css

Related posts about css-selectors