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

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

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Wed, 28 Dec 2011 08:17:56 +0100
Message-ID: <4EFAC2A4.4060500@kozea.fr>
To: www-style@w3.org
Le 27/12/2011 22:43, Peng Yu a écrit :
> Hi,
>
> 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.
>
> Do I miss anything in the document? Or this is discussed in some other
> document that I'm not aware of.

Hi,

As answered before, the class name in CSS is an "identifier", as 
described here:

http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

Everything that can not be literally used in an identifier can be 
escaped with "\" + hexadecimal code. See the above link for the details 
of the escaping syntax.

More reading (also about HTML and JavaScript), a demo, and a tool to try 
your ownn values:

http://mathiasbynens.be/notes/html5-id-class
http://mathiasbynens.be/demo/crazy-class
http://mothereff.in/css-escapes

Regards,
-- 
Simon Sapin
Received on Wednesday, 28 December 2011 07:18:31 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:47 GMT