"Steve Pugh" <st***@pugh.net> wrote in message
news:h9********************************@4ax.com...
On Fri, 1 Oct 2004 20:30:18 +0000 (UTC), "Philip Herlihy"
<fo******@herlihy.eu.veil.com> wrote:"Brian" <us*****@julietremblay.com.invalid> wrote in message
news:md********************@bgtnsc04-news.ops.worldnet.att.net... Mark Tranchant wrote:
> Philip Herlihy wrote:
>
>> If I'm reading my reference books correctly, I should be able to
>> pick out cells in a table by combining a <col> selector with a
>> class selector, like this:
>> col#thisid td.thisclass {color: red; }
>> .. but it doesn't work.
>
> http://www.w3.org/TR/CSS21/tables.html#q4 may help explain this.
Have a look, too, at this:
http://ln.hixie.ch/?start=1070385285&count=1
....1) As what I'm actually after is "background-color" then it ought to
work
If you apply it as a style to the col element, so your #col3 {...}
style should be, and indeed is, applied.
.... #col2 td.special {...}
is a match for all <td> elements with class=special that are
descendents of the element with id=col2
But id=col2 is a <col> element and <td> elements are NEVER descendents
of col elements. As detailed in the W3C page referenced above.
So your selector doesn't match anything. Hence there is nowhere to
apply your style, and so the browsers are getting it perfectly
correct.
Thanks, Steve. I'm grateful for the clarification - as I now understand it,
a <col> is an independent layer with no descendents. What a pity, though!
I have a large table (thousands of small cells) which is intended to be a
visual cross-reference. I want to be able to colour cells in the "key" part
of the table so that "flagged" cells in different columns are different
colours (so if you're in the buying department you look for the green cells
against document names). The only way I can see now to do it is to have as
many classes as there are columns, so instead of simply having a class
"flagged" and using the col-id, I now have to have classes "flagged-col1",
"flagged-col2", etc. Seems a lot more redundant and so prone to error.
Fantasising now - what I'd really like is a "content value" selector: e.g
any element containing the substring "banana" (or even a regular
expression!) should have background image "xyz.gif" and the text itself
should not be visible.
Anyway, thanks for pointing out my misunderstanding!
--
####################
## PH, London
####################