1

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?

1
  • 4
    That's an XML resource, not an HTML resource. Both are very similar, but live by very different rules. Commented Nov 24, 2014 at 0:23

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.