W3C home > Mailing lists > Public > www-style@w3.org > May 2002

Non-adjacent sibling combinator?

From: Tom Gilder <w3c@tom.me.uk>
Date: Thu, 16 May 2002 13:39:01 +0100
Message-ID: <5848958517.20020516133901@tom.me.uk>
To: www-style@w3.org
Hi www-style :)

I'd like to suggest the idea of a non-adjacent sibling combinator - as in a way
to select all other siblings of one element.

For instance, say the combinator was & (not sure this would be such a good
character though, with HTML escaping) - you could then do:

P.test & P { color: red; }

Which would result in:

<p>I would be red</p>
<p class="test">I wouldn't be red</p>
<p>I'd be red too</p>

This could lead to some very helpful hover effects being achieved, such as if
you had a navigation bar with a different background color for the link with the
current page, this would allow that color to be cleared when the user hovered
over any other link:

A:hover & A.selected { background-color: black; }

I've been trying to do something like this myself recently, but found no way to
select all other siblings. If there is a way, do tell :)

Anyway, just an idea - and keep up the excellent work on CSS :)

Tom Gilder
Received on Thursday, 16 May 2002 08:39:08 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:01 UTC