tags:

views:

28

answers:

2

Is it necessary to have selector's name in same case in css and html?

is it ok ?

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

#header{...}

or this is necessary?

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

#HEADER{...}
+2  A: 

Class names and IDs are case sensitive, so they must have the same casing.

Therefore, div.MyClass is not the same as div.myClass.

Element (in HTML) and pseudo-class (everywhere) names are not case sensitive, so DIV:hover is the same as div:HOVER.

For more information, read the spec.

SLaks
+1  A: 

Your second example should be #HEADER{...} but the answer is... some browsers are case sensitive if you use an XHTML doctype. See here: http://webdesign.about.com/od/css/f/blcssfaqcase.htm

catfarm