Philippe Wittenbergh wrote:

On Apr 29, 2011, at 11:24 PM, Alan Gresley wrote:

This is not completely true. Firstly the XHTML is traditional so
it's not true XHTML

That doesn't matter, as ID's starting with a leading digit are not
allowed in html4.01.

Right, but this is really a formality - though a validator message is useful, as it makes the author suspicious. As far as HTML processing is concerned, browsers don't seem to have problems with id values starting with a digit, but they raise some issues in CSS.

The CSS selector is only valid when the (leading) digit is escaped…

Yes, and that makes CSS code somewhat messy, so it's usually best to avoid id attribute values that start with a digit, if you intend to use them in CSS.

IOW: #4col1 {background: lime;} is invalid (and correctly ignored by
browsers)

Yes.

but #\34col1 {background: lime;} is valid

Well, technically it is valid, but it does not match id="4col1". The reason is that since "c" is a hexadecimal digit, "34c" is taken as a hexadecimal number. To make the selector match id="4col1", you can write it e.g. as
\34 col1
(i.e. with a space after "4").

--
Yucca, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to