1

An URL starting with capital letters:

 .test{
     background:url('/Static/Common/background.png');
 }

An URL starting with small letters:

 .test{
     background:url('/static/common/background.png');
 }

It is case-sensitive. But I downloaded a code from a website and it has mixture capitals and small letters but still works.

what is the reason behind this ? can anyone clearly explain it. thanks

Susheel Singh
  • 3,824
  • 5
  • 31
  • 66

2 Answers2

5

URLs may be case-sensitive, but need not.

Basically, it depends on what file system you are running your website on. For instance, most Linux systems will be case-sensitive, while most servers run on Windows will be case-insensitive.

For portability reasons you should always make links to your files exactly match their file paths.

Note that it does not have anything to do with CSS stylesheets. For example, you'll run into the same problem with <a href="LINK"> and <img src="LINK2">.

rr-
  • 14,303
  • 6
  • 45
  • 67
0

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

The trick is that if you write a document using an XML declaration and an XHTML doctype, then the CSS class names will be case sensitive for some browsers.

It is a good idea to avoid naming classes where the only difference is the case, for example:

div.myclass { ...} div.myClass { ... }

If the DOCTYPE or XML declaration is ever removed from your pages, even by mistake, the last instance of the style will be used, regardless of case.

Get more idea from following blogs :

http://webdesign.about.com/od/css/f/blcssfaqcase.htm

http://www.css-zibaldone.com/articles/syntax/css-syntax.html

Divya Bhaloidiya
  • 5,018
  • 2
  • 25
  • 45
  • 1
    The question is about case-sensitivity of URLs, not class names or other things. –  Jul 12 '13 at 07:36