Naming id’s with numbers
Date: 10 April 2008
Author: Russ Weakley
I was recently sent this question:
I am trying to apply a div to a page and it will not show when I use the name “420wide” but it will if I use “wide420″. Why is this? Is this rule documented somewhere?
The simple answer is that the ID name must be unique in a document and it must begin with a letter – not a number.
You can find out more in the W3C’s HTML specification relating to the id attribute:
id = name [CS]
This attribute assigns a name to an element. This name must be unique in a document.
There are two associated links with this info:
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 (“.”).
CS – The value is case-sensitive (i.e., user agents interpret “a” and “A” differently).

It never ceases to amaze me how many people don’t know these fundamental rules (especially the fact that id’s must be unique per page) when they have always been clearly defined at w3c.
thank you for this Article
Great Point
ok, new checklist item to add my development process. Thanks for this.
I already noticed that, but I haven’t consulted the reference to check it. And reading this made me remember that experience.
Thanks for remembering me of this.
Well rb not everyone knows the rules like you, a lot of designers are learning as they go and you cannot expect them to know. But its good that you…
Thanks for the tip Russ, as I know myself I have made this mistake and im sure many others have as well….
ABC of CSS!
Basics are more important than anything!
[...] Algo que deberÃas saber: Cuando trabajes con XHTML/CSS las id’s deben empezar con una letra (A-Z / a-z) y no un número. El segundo caracter si puede ser un número (un guión, un punto, etc.). En caso de que esta regla no sea respestada, no se reconocerá la id. [...]
Thanks for this “mise au point”