W3C home > Mailing lists > Public > www-style@w3.org > December 1999

ancestor at-rule

From: Sjoerd Visscher <sjoerd@heeten.nl>
Date: Mon, 6 Dec 1999 00:41:42 +0100
Message-ID: <001701bf3f7a$4a7f9b20$1400000a@beneden>
To: "www-style" <www-style@w3.org>
Hi all,

I am using CSS more and more lately, and I notice that I need the following
pattern very often:

A B {...}
A C {...}
A D {...}

I use this f.e. when I have a table that needs to jump out of the rest of
the page, and the <TR>,<TD>,<TH> and often also <A> need to be differnt for
this case. I do not want to add a class to all these elements, so I only add
a class to the table, which results in the following css:

TABLE.special TR {...}
TABLE.special TH {...}
TABLE.special TD {...}
TABLE.special A {...}

This is not only clumsy and ugly, it is also very slow. (As was demonstrated
by similar cases in the UI of Mozilla)

To solve this I'd like to introduce the following:

@has-ancestor TABLE.special {
    TR {...}
    TH {...}
    TD {...}
    A {...}
}

This makes the rule matching much faster, because a UA only has to look for
matches in the subtree of TABLE.special elements.

If anyone has a better solution (especially when it's done with CSS2) please
let me know.

Sjoerd Visscher
Received on Sunday, 5 December 1999 18:45:59 GMT

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