Skip navigation

tr:nth-child(2n+1) /* represents every odd row of an HTML table */ 
tr:nth-child(odd)  /* same */  
tr:nth-child(2n+0) /* represents every even row of an HTML table */  
tr:nth-child(even) /* same */    
/* Alternate paragraph colours in CSS */ 
p:nth-child(4n+1) { color: navy; }  
p:nth-child(4n+2) { color: green; }  
p:nth-child(4n+3) { color: maroon; }  
p:nth-child(4n+4) { color: purple; }

via w3.org
Remember to put these rules on the child elements and not the parent.
Posted via web from Apphacker’s learning curve

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: