[thelist] what characters are allowed in class="..."?

Lee Kowalkowski lee.kowalkowski at googlemail.com
Mon Dec 24 15:15:42 CST 2007

On 24/12/2007, Hassan Schroeder <hassan.schroeder at gmail.com> wrote:
> On Dec 24, 2007 5:06 AM, Zhang Weiwu <zhangweiwu at realss.com> wrote:
> > I read the spec and understood it in a way that all characters except
> > carrier-return and spaces are allowed to be used as class name:
> > http://www.w3.org/TR/html4/struct/global.html#h-7.5.2
> How you get "all characters" out of this:
> <quote>
> ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
> followed by any number of letters, digits ([0-9]), hyphens ("-"),
> underscores ("_"), colons (":"), and periods (".").
> </quote>

That's the definition of ID and NAME (for the ID attribute), not CDATA
(for the class attribute).  Here:

However, that's not all, the CSS specification has further
restrictions: http://www.w3.org/TR/CSS21/syndata.html#characters

> :: I'm not sure, but yes, hyphens are OK.

LOL, same conclusion anyway!  Perhaps vim is highlighting html tag names.

I had trouble with underscores in Opera 6 (or maybe even older), but
that resulted in me using dashes pretty much all the time.


More information about the thelist mailing list