Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS file name case sensitivity & Css file caching

Tags:

html

css

caching

We are in the process of rewriting some of our websites and trying to make the most use of browser caching for our users. We have created a group of shared css files that we plan to use as a "corporate branding" across multiple sites that we've created.

The reason for this, we know that browsers will cache a CSS file for a determined length of time. What if I specify the same file name in different sites with a different casing, will it cache both version of the file (even tho they are the same content) or will it recognize that it's the same file, thus ignoring the case of the filename


<link href="http://branding.corporateentity.com/style/screen.css" type="text/css" />
<link href="http://branding.corporateentity.com/style/print.css" type="text/css" />

vs:


<link href="http://branding.corporateentity.com/Style/Screen.css" type="text/css" />
<link href="http://branding.corporateentity.com/Style/Print.css" type="text/css" />
like image 239
Anthony Shaw Avatar asked Oct 23 '09 15:10

Anthony Shaw


People also ask

Are file names case-sensitive HTML?

Upper and lower case The Web server is a Unix computer and Unix is case sensitive. When typing in the filenames of your HTML files and related image files you must be consistent. If the filename is all or partly in Upper case, all references to that file must reflect this accurately.

Is the pseudo class names are case-sensitive?

Pseudo-class names are not case-sensitive.

What is the default CSS file name?

css” is the default name given to any CSS file.


2 Answers

URLs are case-sensitive, so the best thing is to always use a particular case. I recommend making everything lowercase (and separating words with dashes) for simplicity. This is also recommended for your page names and images, for SEO purposes.

Browsers will treat different case as different files since they don't know whether the server is doing the same. Therefore, the browser will not use its cache of style/screen.css if it sees a link to Style/Screen.css.

like image 109
DisgruntledGoat Avatar answered Oct 01 '22 09:10

DisgruntledGoat


URL's are case sensitive, and browsers follow that standard- a different case is a different file. I would hesitate to use the example above however, because some browsers may not follow the standard protocall (for example, i think Windows is not case sensitive, and wonder if some sad old browsers can't tell the difference between 'file' and 'File').

like image 43
superUntitled Avatar answered Oct 01 '22 09:10

superUntitled