|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
The w3C validator says that a numeric ID, such as:
<div id="1"> (or an ID beginning with a number) is invalid: "It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit." But I can't seem to find anything that says you can't use a numeric ID - I'll grant that I'm not a master at reading the specs, but all I CAN find is that an ID should be unique, and should not use character encoding. Maybe I'm just not seeing it: http://www.w3.org/TR/REC-html40/stru....html#h-12.2.1 http://www.w3.org/TR/REC-html40/stru....html#h-12.2.3 http://www.w3.org/TR/REC-html40/stru...l.html#h-7.5.2 So - what about numeric ID's like above? Is it valid? And assuming it's not, what sort of problems, aside from validation errors, would it cause? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Tony wrote:
> The w3C validator says that a numeric ID, such as: > <div id="1"> > (or an ID beginning with a number) is invalid: "It is possible that you > violated the naming convention for this attribute. For example, id and > name attributes must begin with a letter, not a digit." > > > But I can't seem to find anything that says you can't use a numeric ID - > I'll grant that I'm not a master at reading the specs, but all I CAN > find is that an ID should be unique, and should not use character > encoding. Maybe I'm just not seeing it: > http://www.w3.org/TR/REC-html40/stru....html#h-12.2.1 > http://www.w3.org/TR/REC-html40/stru....html#h-12.2.3 > http://www.w3.org/TR/REC-html40/stru...l.html#h-7.5.2 > > So - what about numeric ID's like above? Is it valid? And assuming it's > not, what sort of problems, aside from validation errors, would it cause? They're not valid. Refer to: http://www.w3.org/TR/REC-html40/types.html#type-name |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Tony wrote:
> The w3C validator says that a numeric ID, such as: <div id="1"> (or an > ID beginning with a number) is invalid: "It is possible that you > violated the naming convention for this attribute. For example, id > and name attributes must begin with a letter, not a digit." > > But I can't seem to find anything that says you can't use a numeric > ID - I'll grant that I'm not a master at reading the specs, but all I > CAN find is that an ID should be unique, and should not use character > encoding. Maybe I'm just not seeing it: > http://www.w3.org/TR/REC-html40/stru....html#h-12.2.1 > http://www.w3.org/TR/REC-html40/stru....html#h-12.2.3 > http://www.w3.org/TR/REC-html40/stru...l.html#h-7.5.2 http://www.w3.org/TR/1999/REC-html40...html#type-name "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 (".")." You're reading the old HTML 4.0 specs, but it is there as well. http://www.w3.org/TR/REC-html40/types.html#type-name > So - what about numeric ID's like above? Is it valid? No. > And assuming it's not, what sort of problems, aside from validation > errors, would it cause? Can't answer that; I've never used a number because it's against the spec. <g> -- -bts -Friends don't let friends drive Vista |
|
![]() |
| Outils de la discussion | |
|
|