MathCurvesSurfacesWallpaper GroupsGallerySoftwarePOV-Ray
ProgramingLinuxPerl PythonHTMLCSSJavaScriptPHPJavaLang DesignEmacsUnicode ♥

Case Sensitivity in HTML5/XML/CSS/Javascript and Allowed Characters in Attribute Names

, , …,

Case Sensitivity

Recommendation: always use lower case when you can.

Allowed Characters in Attribute Names

Allowed chars in “id” attribute value (⁖ <div id="myID">…</div>) must start with a letter (A to Z, uppper or lowercase). After that, it can be digits (0 to 9), hyphen -, underscore _, colon :, period ..

In practice, you can start with a Unicode char in id, such as “α”, and the W3C validator will pass it as valid (as of ). 〔☛ Using Unicode in HTML Attributes

In HTML5, it vaguely suggests that the value of id can be any char that's not space.

Reference

http://www.w3.org/TR/html4/types.html#type-id, Quote:

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

http://www.w3.org/TR/html401/intro/sgmltut.html#attributes, Quote:

In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them.

Attribute names are always case-insensitive.

Attribute values are generally case-insensitive. The definition of each attribute in the reference manual indicates whether its value is case-insensitive.

http://dev.w3.org/html5/spec/global-attributes.html#the-id-attribute, Quote:

3.2.3.1 The id attribute

The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character. The value must not contain any space characters.

blog comments powered by Disqus