CSS 2.1 – some interesting things about specifications

filled under:
August 7, 2007 

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.

tags:

Leave a Reply

Your email address will not be published.Required fields are marked bold.

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  1. puRe ( August 7, 2007 at 10:48 am )

    Damn, you got waaay to much time. And btw, check the tabindex on your input fields ;)

  2. biophonc ( August 7, 2007 at 11:37 am )

    ahm, let me think – no ;) but I’ll have a look on the tab indexes.