Re: CSS grammar/syntax

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
underscores:

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.

-David

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