<style>
tr:nth-child(1){background:#ff0000;}
tr:nth-child(2){background:#ffffff;}
</style>
http://www.w3schools.com/cssref/sel_nth-child.asp

Date: Sun, 14 Jul 2013 08:53:14 +1000
Subject: [OT] css and table columns
From: [email protected]
To: [email protected]

Folks, when styling <table> columns with css it gets really messy when you have 
to apply a class to each cell like this: <table>  <tr><td 
class="cls1">A</td><td class="cls2">B</td><td class="cls3">C</td></tr>
  :</table> Is there some css syntax where you can make rules like the 
following thereby avoiding the need to clutter up the actual table markup:
 The first cell of each row has class "col1"The second cell of each row has 
class "col2"etc Greg K                                        

Reply via email to