Style the first <td> column of a table differently
If I have a table with two columns, how do I specify a padding or any other css so that it is applied just for the first column of <td> s. Also how do I style an n-th column similarly? RRikesh You could use the n-th child selector . to target the nth element you could then use: td:nth-child(n) { /* your stuff here */ } (where n starts at 1) If you've to support IE7, a more compatible solution is: /* only the cells with no cell before (aka the first one) */ td { padding-left: 20px; } /* only the cells with at least one cell before (aka all except the first one) */ td + td { padding-left: 0; }