On Apr 30, 2011, at 3:19 PM, Jukka K. Korpela wrote:

>> 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.

My commenting on what HTML4.01 says was really nitpicking, in case you din't 
notice :-p. Browser don't really care, afaik; and that is probably one reason 
why HTML5 doesn't make ID's starting with a digit invalid.

>> 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.

Sure, I wouldn't advocate it either; I can picture all those flashy web-apps 
and friends though, with tons of script generated ID's. Even then, I would 
recommend to prefix those ID's.
(on example: the Discuss commenting system attaches ID's to every possible 
element. They do prefix them, afaict.)

>> 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").

Right, I intended to type that space there, obviously it didn't go beyond 
intention. Blame the weather, or the wave, or something.

Philippe
--
Philippe Wittenbergh
http://l-c-n.com/






______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
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