- From: Bert Bos <Bert.Bos@sophia.inria.fr>
- Date: Wed, 19 Jul 2000 16:37:31 +0200 (MEST)
- To: "Bruno" <bruno@teraram.com>
- Cc: <www-style@w3.org>
Bruno writes:
> Could someone give me more informationa about that
>
> p.a\:b { color: purple }
>
> Where is "\" in CSS, where can I find examples of that "thing", what for is
> it anyway, I really did not understand you so can you explain it to me in
> details:)
OK, let me try:
The problem is that there is a difference in the values that HTML
allows in the CLASS attribute and what CSS allows after the dot in a
class selector. In most cases things work as you expect:
<EM CLASS="intro77">
matches
EM.intro77 { color: red }
But HTML allows more or less any symbol apart from space, so you could
invent a class name like this:
<EM CLASS="intro@77+1">
But
* EM.intro@77+1 { color: red }
is illegal syntax in CSS, since "@" and "+" are reserved for other
things. To fix this, CSS allows the illegal symbols to be escaped:
EM.intro\@77\+1 { color: red }
The backslash (\) basically means that whatever follows it should be
treated just like a letter.
See http://www.w3.org/TR/REC-CSS2/syndata.html#q4
Bert
--
Bert Bos ( W 3 C ) http://www.w3.org/
http://www.w3.org/people/bos/ W3C/INRIA
bert@w3.org 2004 Rt des Lucioles / BP 93
+33 (0)4 92 38 76 92 06902 Sophia Antipolis Cedex, France
Received on Wednesday, 19 July 2000 10:38:07 UTC