Vendor-Specific CSS Extensions

Posted by mdrisser on 2009/11/30 under Design, Web Browsers, css | Be the First to Comment

I just read an article over at 456 Berea St. stating that “Vendor-specific extensions are invalid CSS“. Unfortunately comments are turned off for the article, so I can’t post this there.

The author of the article states his or her case based on information contained here. In all fairness the author of the post does say “to the best of my understanding”, these extensions are invalid. Unfortunately the author failed to read further, in point of fact the specification referenced specifically allows vendor-specific extensions.

4.1.2.1 Vendor-specific extensions

In CSS, identifiers may begin with ‘-’ (dash) or ‘_’ (underscore). Keywords and property names beginning with -’ or ‘_’ are reserved for vendor-specific extensions. Such vendor-specific extensions should have one of the following formats:

‘-’ + vendor identifier + ‘-’ + meaningful name
‘_’ + vendor identifier + ‘-’ + meaningful name

Example(s):

For example, if XYZ organization added a property to describe the color of the border on the East side of the display, they might call it -xyz-border-east-color.

Other known examples:

-moz-box-sizing
-moz-border-radius
-wap-accesskey

An initial dash or underscore is guaranteed never to be used in a property or keyword by any current or future level of CSS. Thus typical CSS implementations may not recognize such properties and may ignore them according to the rules for handling parsing errors. However, because the initial dash or underscore is part of the grammar, CSS 2.1 implementers should always be able to use a CSS-conforming parser, whether or not they support any vendor-specific extensions.

Authors should avoid vendor-specific extensions

(You can read it for yourself here)

Vendor-specific extensions are allowed in the specification, which makes them valid by default. Do take note of the last sentence however, “Authors should avoid vendor-specific extensions.” Not the same as being invalid.

My problem with that last sentence is this, we’ve been waiting a long time for a lot of the new extensions in CSS3, in fact CSS 2.1 is still a working draft as is CSS3, some vendors, notably Mozilla, Webkit, Opera and Konqueror; have taken pity on us as designers and developers and created vendor-specific extensions to allow us to use some of these long awaited extensions. If the W3C is going to move at a snails pace (CSS3 has been a draft since 2001, CSS 2.1 since at least 1998), then by all means USE vendor-specific extensions.

Why are validators not recognizing that these extensions are valid? The grammar/syntax for them is contained within the draft specification, why not check for them? Don’t recognize the extension? Does it conform to the rules for vendor-specific extensions? If so then it is valid. Pretty simple.

They’ve given us rules for them, but then tell us not to use them, so basically they’re teasing us, placing the cookie jar within our grasp and saying, “Now don’t you touch them.” And shame on the validators for turning a blind eye to the whole thing. I for one use them and will continue to use them until the drafts all get caught up/finalized and/or vendors drop support for them.

  • Share/Bookmark

Add A Comment