- From: XStandard <lists@xstandard.com>
- Date: Thu, 16 Mar 2006 17:57:58 -0500
- To: <www-style@w3.org>
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
Received on Thursday, 16 March 2006 22:58:01 UTC