@version rule

CSS needs something similar to the xsl:version attribute in XSLT whereby
a newer user agent can use backwards-compatibility mode for a stylesheet
written with an older version of CSS. 
For instance, the :first-letter pseudo-element is valid CSS1 but not
valid CSS3 (it needs to be ::first-letter). A fully compliant browser
should accept the single-":" form in a CSS1 stylesheet while rejecting
it in a CSS3 stylesheet.
CSS could also define a more detailed forward-compatibility mode like
XSLT's for cases where the UA knows it doesn't support the current
stylesheet based on the version rule.
I propose that an @version rule be added of the syntax:
@version version-string
Where version-string is the version of CSS the stylesheet is written in.
"3" for CSS3, "2.1" for a hypothetical CSS 2.1, "17" for CSS17. . .
If this works: 
Once the version of the entire stylesheet has been established,
additional @version rules could provide alternative stylesheets for
downlevel browsers like so:
<code>
@version "3";
/*CSS 3 selectors here*/
@version "2.1"
{
	/*CSS 2.1 selectors here*/
}
@version "4"
{
	/*Some neat CSS 4 feature that completely breaks backwards
compatibility*/
}
/*More CSS 3 selectors here*/
</code>
I don't know how the cascade should work with these rules.

If there's a feature like this already built into CSS, please point me
to it.

Jeffrey Yasskin

Received on Thursday, 26 July 2001 20:36:08 UTC