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

css selectors

From: Lachlan Cannon <luminosity@members.evolt.org>
Date: Mon, 8 Jul 2002 18:25:47 +1000 (EST)
Message-ID: <1045.139.130.216.191.1026116747.squirrel@members.evolt.org>
To: <www-style@w3.org>

I think that there is a need for a selector in CSS, which selects an
element of a certain type which directly precedes an element of another
type. Already in CSs we can specify E+F which matches element F directly
following element E, and this would work along the same lines, something
like E-F would match an F element directly before an E element.

Perfect example of why this is needed:

Take a set of blockquotes. Now the generally held typography rule is that
every one should have a starting quote, but only the very last one from
the same source should have an ending quote. Currently, the only way you
could specify this would be to give every blockquote only a quote at the
start, and then use a class on the last blockquote and blockquotes of that
type would receive an ending quote as well. However this could very
quickly get tedious, especially when you're putting up single blockquotes
at a time.

If you had the E-F selector, you could simply use the rules:

blockquote {
	quotes: '"' '"';
}

blockquote-blockquote {
	quotes: '"' '';
}

blockquote:before {
	content: open-quote;
}

blockquote:after {
	content: close-quote;
}

And only the last one would receive an ending quote.

Lach
_____________________________________
http://members.evolt.org/luminosity/
MSN: luminosity @ members.evolt.org
_____________________________________
Received on Monday, 8 July 2002 04:26:06 GMT

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