Member Avatar for ingeva

Yesterday I discovered that FireFox refused to read CSS files that did not have the CSS extension.

I have a basic CSS that's always read, based on the CSS extension (I have a script that automatically loads all CSS files found in the local directory).
Then I had a set of files with the extension .css2, and the script selects ONE of them in a random fashion.
After some trial and error I found that the files were not read as long as they did not have the extension .css.

I found another solution but now I wonder: Is this a standard restriction, or is it just FireFox? (I use 3.0.13).

I use the standard statement:

<link rel='stylesheet' type='text/css' href='filename' />

Recommended Answers

All 3 Replies

I think you will find this is universal - ie. occurs in all browsers.

But it's hardly a limitation. Simply ensure all your css files have the .css extension.

Airshow

Browsers don't typically about the extension of a css style as long as the MIME type is correct.
This is sent using HTTP headers, and can be changed using a server-side scripting langage, or an htaccess override for .css2 files.
In your case, the server is seeing css2 as unknown and sending it out as text/plain instead of text/css.
More Information...

Member Avatar for ingeva

In your case, the server is seeing css2 as unknown and sending it out as text/plain instead of text/css.

OK, thanks! I just though that my type specification (text/css) would override this.

The easiest solution in my case will be to include these CSS specification in the source (html) file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.