[thelist] What's the reasoning behind not starting IDs with a number?

kasimir-k kasimir.k.lists at gmail.com
Thu Jan 11 06:02:38 CST 2007


> On 11/01/07, Will Mo <willthemoor at gmail.com> wrote:
>> So then, do tell.  Just what's the matter with an ID of "12-06" (month-year
>> in this case).

Lee kowalkowski scribeva in 11/01/2007 10:01:
> If you're talking about HTML id attributes, the HTML specification
> says they must start with a letter (a-z) and only contain
> alphanumerics, hyphens, underscores, colons and periods.

Just to add relevant links to the specs:

For HTML:
http://www.w3.org/TR/html4/types.html#type-name

For XML:
http://www.w3.org/TR/2006/REC-xml-20060816/#id
says "Values of type ID  MUST match the Name production." and
http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name
tells what that production is.

And while HTML letters are [A-Za-z] XML has wider range:
http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Letter

And XHTML is XML too, "Therefore, in XHTML 1.0 the id attribute is 
defined to be of type ID." (http://www.w3.org/TR/xhtml1/#h-4.10)

.k



More information about the thelist mailing list