designer wrote:
I have been playing with the underscore hack and noticed that almost
anything that isn't 0-1 or a-z performs the same trick.
[...]
Is this very naughty? It doesn't  validate as CSS, but then neither does the
underscore hack (unless the validator is wrong, as some would have us
believe).

So what's the story here?

Look at the CSS2.1 spec's section on syntax and keywords http://www.w3.org/TR/CSS21/syndata.html#keywords

"In CSS2.1, identifiers may begin with '-' (dash) or '_' (underscore). Keywords and property names, beginning with -' or '_' are reserved for vendor-specific extensions."

"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***, CSS2.1 implementers should always be able to use a CSS-conforming parser, whether or not they support any vendor-specific extensions." (emphasis mine)

So, as per spec, the underscore can "legally" be used. Other characters are just syntax errors.
As for the validators: they're correct in that anything prefixed with underscore is invalid in the light of the official W3C CSS spec (as it implies vendor specific properties which go outside of the spec), but that doesn't mean that the underscore isn't legal in the wider context of CSS grammar (while, again, other characters are both outside of spec *and* break the grammar rules)


--
Patrick H. Lauke
_____________________________________________________
re·dux (adj.): brought back; returned. used postpositively
[latin : re-, re- + dux, leader; see duke.]
www.splintered.co.uk | www.photographia.co.uk
http://redux.deviantart.com

******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************



Reply via email to