Re: [CSS21] properties for table-column (In HTML: COL) & table-column-group (In HTML: COLGROUP) items.

On Jun 22, 2005, at 11:49 AM, Kris@meridian-ds.com wrote:

>
> Can't you just use an :nth-child for tds in a tr?
>
> tr:nth-child(1) {
>   background-color:#lime;
> }
>
> Just specificy what you want the colors to be inside of nth-child,  
> and move
> on with life.  This should allow you to color any column you please.
> Course, the requires nth-child support but yeah... css will do it with
> ease.
>
> Kris
>

This doesn't work once you start spanning columns. Imagine the  
following html table:

<table>
     <tr>
         <td>Cell 1:1</td><td>Cell 1:2</td><td>Cell 1:3</td>
     </tr>
     <tr>
         <td colspan="2">Cell 2:1</td><td>Cell 2:2</td>
     </tr>
</table>

Using tr:nth-child(3) to highlight the third column breaks here. It  
also could not handle adding or subtracting columns dynamically. I've  
argued for this before on the list, and have always been told it's an  
implementation nightmare. But it /is/ necessary if we truly want to  
use tables for data.

-- 
Ryan Cannon
Instructional Technology
Web Design
http://RyanCannon.com

Received on Wednesday, 22 June 2005 17:16:48 UTC