- From: Garrett Smith <dhtmlkitchen@gmail.com>
- Date: Thu, 16 Mar 2006 16:17:32 -0800
- To: www-style@w3.org
According to the spec (if I'm reading right), they can. ident [-]?{nmstart}{nmchar}* link: http://www.w3.org/TR/CSS21/syndata.html#tokenization On 3/16/06, XStandard Vlad Alexander <lists@xstandard.com> wrote: > > Sorry if this has already been asked. Can identifier names (classes and IDs) start with a hyphen? > > This is why I got confused: > > [spec source: http://www.w3.org/TR/CSS21/syndata.html] > In CSS 2.1, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [A-Za-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit. > [/spec] > > That's clear. IDs like "-abc" are okay but "-0abc" are not. The spec then reads: > > [spec source: http://www.w3.org/TR/CSS21/syndata.html] > Only properties, values, units, pseudo-classes, pseudo-elements, and at-rules may start with a hyphen (-); other identifiers (e.g. element names, classes, or IDs) may not. > [/spec] > > This seems to contradict the previous statement and says that IDs like "-abc" are invalid. > > I ran the following 2 rules through the W3C CSS validator and according to the validator, both are valid: > > #-abc {color:red} > #-0abc {color:red} > > Thanks, > -Vlad > > > > -- http://dhtmlkitchen.com/
Received on Friday, 17 March 2006 00:17:41 UTC