Case Sensitivity in HTML/HTML5/XHTML/CSS

Perm URL with updates: http://xahlee.org/js/case_sensitivity_html5_xml_css_js.html

Case Sensitivity and Allowed Characters in Attribute Names

  • HTML4, HTML5: tag names are NOT case sensitive. <p class="…">…</p> = <P cLAss="…">…</p>
  • XHTML, XML: are case sensitive, and must be all lowercase.
  • ID element, attributes values, in any HTML/XML are case sensitive. e.g. <span class="aaa"><span class="AAA">.
  • Javascript is case sensitive.

Best is to always be case sensitive in your code.

Allowed chars in “id” <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 -, 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 2012-03-29). (➲ Using Unicode in HTML Attributes)