W3C home > Mailing lists > Public > www-style@w3.org > July 2000

Re: CSS grammar/syntax

From: L. David Baron <dbaron@fas.harvard.edu>
Date: Mon, 10 Jul 2000 15:30:55 -0400 (EDT)
Message-Id: <200007101930.PAA31965@is02.fas.harvard.edu>
To: jonathan.beales@progeny.net, www-style@w3c.org
On Mon, 10 Jul 2000 14:09:36 -0400, "Beales, Jonathan"
(jonathan.beales@progeny.net) wrote:
> I've been doing some work recently using CSS to format XML.  I used a
> variety of tools including the CSS valuators, multiple browsers, and
> specialized CSS editing tools.  Some tools act quite different than others
> so I often check back with the spec to see which is correct.  Recently,
> while examining some XML that contained underscores within element names, I
> noticed an oddity between CSS and XML.  In reading the CSS grammars (1, 2, &
> 3), I've noticed that underscores are not valid within element names.
> However, the XML spec allows elements to contain underscores.

Underscores are allowed within element names.  They just aren't allowed
to be unescaped within identifiers.  If you want to write CSS rules to
match XML element names with underscores, then you must escape the

elem\_with\_underscores {
  color: red;

It's a good thing that some characters are not part of identifiers, so
that they can be used in future extensions of CSS without breaking
backwards compatibility.


L. David Baron        <URL: http://www.people.fas.harvard.edu/~dbaron/ >
Rising Junior, Harvard                           Summer Intern, Netscape
dbaron@fas.harvard.edu                               dbaron@netscape.com
Received on Monday, 10 July 2000 15:31:02 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:54 UTC