Is CSS case sensitive?

 Posted by Chikul on 1/23/2010 | Category: CSS 3 Interview questions | Views: 5114

Cascading Style Sheets (CSS) is not case sensitve. However, font families, URLs to images, and other direct references with the style sheet may be.

If your page uses an XML declaration and an XHTML DOCTYPE then the CSS selectors will be case-sensitive for some browsers, if your page uses a HTML DOCTYPE then your CSS selectors will be case-insensitive.

It is a good idea to avoid naming classes where the only difference is the case, for example:
div.myclass { ...}
div.myClass { ... }

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response