W3C home > Mailing lists > Public > www-style@w3.org > December 2011

Re: "." in class selectors where class names have special characters

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 27 Dec 2011 15:46:51 -0800
Message-ID: <CAAWBYDATG0zsU+vo-tJq-gUKpo3fpN7r4OkQYxuY1f0B7DpGBQ@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: www-style@w3.org
On Tue, Dec 27, 2011 at 3:31 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 12/27/11 4:43 PM, Peng Yu wrote:
>> http://www.w3.org/TR/CSS2
>> The above document doesn't explain what characters are allowed when
>> "." is used as the class selectors. For example,
>> <div class="100.100"></div>
>> Selecting the above element by div.100.100 seems not to work.
> div.100\.100 should work fine.  This is covered in the spec you linked to.

Not quite - classes can't start with a digit.  You need to *also*
escape the first digit, producing a selector like:

div.\31 00\.100 { ... }

This is pretty ugly, of course.

Peng, you should avoid using classes that start with a digit or that
contain "special" characters.  Just use digits, letters, dashes, and
underscores for your classes, and don't start them with a digit.

Received on Tuesday, 27 December 2011 23:47:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:50:11 UTC