W3C home > Mailing lists > Public > www-style@w3.org > June 2005

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

From: Ryan Cannon <ryan@ryancannon.com>
Date: Wed, 22 Jun 2005 13:16:40 -0400
Message-Id: <C4DC94F7-EDC8-4EDF-BE03-F578C1C3EEFF@ryancannon.com>
Cc: www-style@w3.org
To: Kris@meridian-ds.com

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:37 GMT