Do I need to have a selector name in the same case in css and html?

Do I need to have a selector name in the same case in css and html?

this is normal?

<div id="HEADER"> </div>

#header{...}

or is it necessary?

<div id="HEADER"> </div>

#header{...}
+3
source share
2 answers

Class names and identifiers are case sensitive, so they must have the same enclosure.

Therefore, div.MyClass does not coincide with div.MyClass.

Element (in HTML) and pseudo-classes (everywhere) are not case sensitive, therefore DIV:hover matches with DIV:hover.

For more information read the spec .

+2
source
+1

Source: https://habr.com/ru/post/1729804/


All Articles