HTML attribute names are case-sensitive? Conflicting information.

I just read that attribute names are case-sensitive:

Attribute names are also case-sensitive, for example the two width attributes in and (if they occurred in the same file) are separate attributes, because of the different case of width and WIDTH;

(http://xml.silmaril.ie/case.html)

But then I went on JSFiddle to try

HTML

<p ID="myId">Let's see if this is red</p>

CSS

#myId {color: red;}

and, indeed, the text was red: http://jsfiddle.net/xtLr08u7/.

Which is correct?

Upvotes: 1

Views: 940

Answers (2)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

They means for custom attributes only. The normal attributes are not case-sensitive.

Such as <tag myAttr="myattr" MyAttr="MYATTR"></tag> (refers to XML not HTML)

Upvotes: 0

Jose Rey
Jose Rey

Reputation: 251

Attribute names are not case sensitive in neither HTML 4 nor in HTML5, as the W3C HTML Reference says.

But XHTML (HTML with XML syntax) is case sensitive.

Upvotes: 4

Related Questions