See a similar question: Why are style sheet columns not allowed?
You are allowed to set the border , background , width and visibility properties, because the cells are not direct descendants of the columns, only from the rows.
There are several solutions. The simplest thing is to add a class to each cell in the column. Unfortunately this means more HTML, but should not be a problem if you are generating tables from a database, etc.
Another solution for modern browsers (i.e. not IE6) is to use some pseudo classes. tr > td:first-child will select the first cell in the row. Opera, Safari, Chrome, and Firefox 3.5 also support the :nth-child(n) selector, so you can target specific columns.
You can also use td+td to select from the second column ahead (this actually means “select all td elements that have one td element on the left). td+td+td selects from the third column - you can continue this way by overriding the properties. Honestly, this is not great code.
DisgruntledGoat Aug 6 '09 at 11:11 2009-08-06 11:11
source share