[thelist] validating css

James Aylard evolt at pixelwright.com
Thu Sep 26 11:01:01 CDT 2002


> Thanks, (I didn't know you couldn't use underscores )

    The answer is, you _can_ use underscores, but for historical reasons you
probably shouldn't. When the CSS 2 recommendation was released, underscores
were (apparently inadvertently) left out of the definition for identifiers
[1]. The CSS Working Group corrected this in the CSS 2 errata [2], and has
further codified it in the CSS 2.1 Working Draft [3].
    The problem: some strictly conforming browsers released pre-errata
(Mozilla and Opera, IIRC) do not permit underscores in identifiers; however,
some time after the errata note was released, these browser makers recoded
to allow them. So using underscores in identifiers can be risky unless you
have a known target audience whose browsers support the underscore (such as
on an Intranet). And for the record, IE has always allowed underscores in
    As for the validator, it _should_ allow underscores; in my testing, it
appears to trip over them, so I consider it a bug in the validator.

1. http://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
2. http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html#x1
3. http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

James Aylard

More information about the thelist mailing list