/ code

CSS 2.1 - some interesting things about specifications

According to the Specification (4.1.3 Characters and case), identifiers can contain only alphanumerical characters [a-z0-9] and - big surprise - ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and underscore (_).

That's totally new to me and I've never ever seen someone who uses special characters like that for identifiers. Actually this is really bullshit, because no Validator supports identifiers like that. For instance: when you are going to use the ampersand character, HTML expects an html-entity and will fail. The Validation will not fail, when you use the copyright sign (�?© = U+00A9) - but it will fail, when you not write the ampersand as html-entity (&)

Here is an example CSS which will be displayed correctly in most browsers (ff2, ie7, opera9, safari3):

.A\&A { 
    background-color: #D1EDEC;
    border: 1px solid #92C0DA
}
.A\26B { 
    background-color: #D1EDEC;
    border: 1px solid #92C0DA
}
.A\000026C { 
    background-color: #D1EDEC;
    border: 1px solid #92C0DA
}

Nevertheless: it will fail the �all mighty� validator.w3.org test, when the class names are assigned to elements (because of the ampersand). I perfectly understand why the ampersand fails, but IMHO I think it shouldn't be allowed plus [a-z0-9] and hyphens should be enough to describe the class/id.

CSS 2.1 - some interesting things about specifications
Share this