Incorrect MIME Type for CSS Files
What is the problem?
You may come across a web page using CSS with poor layout with Netscape
7.x or any Gecko-based browser such as Mozilla, while MSIE displays it nicely.
One of the common reasons for this is an improper configuration of the web
server hosting the CSS file. Some Apache and iPlanet web servers are associating
files having a .CSS with an incorrect MIME-type such as "text/plain" or "text/x-pointplus".
In some cases, Netscape 7.x and Mozilla ignore the CSS file because of its
wrong MIME type and use a default style sheet that causes the layout to be
different from what was intended by the web developer.
When does this happen?
The W3C
specification mentions that CSS files should be served with a "text/css"
MIME type. Mozilla and Netscape 7.x, when used in "strict mode" will follow
the specification closely and expect the CSS file to be served with a correct
MIME type ("Strict mode" is enabled by having a strict DTD mentioned in the
first line of the HTML page). In "quirks mode", both application will tolerate
the wrong MIME type and use the attached style sheet despite the incorrect
server configuration. This means that you cannot have "Strict" documents
with a misconfigured server. MSIE lets you get away with this misconfiguration
by incorrectly not taking care of the MIME type provided by the server in
the http header.
What can I do to change this?
You must ask the server administrator to update the MIME type configuration
file for the web server.
This issue, for iPlanet/Netscape web servers has already been acknowledge
by the vendor, who has issued a tech note in its knowledge base.
If you use Apache, you could also change configuration of the .htaccess
file in your root directory (The .htaccess file is a read-only configuration
file that handles a few things including MIME types.). Add this line to your
.htaccess file:
AddType text/css .css
Please note that some Webmasters disable the use of .htaccess configuration
file on their Apache server because it has a small performance hit.
Conclusion
Using a strict document type definition with Mozilla means that the web
server that serves your web pages needs to be configured appropriately. There
are several workarounds to this problem, but the most effective is to have
the correct MIME type associated with .css files. Ask the Webmaster to fix
this for you, all everybody publishing html documents with strict DTDs will
thank you!
Additional resources
Properly Configuring Server MIME Types
Changing MIME types on iPlanet/Sun Web Server:
http://sunsolve.sun.com/pub-cgi/retrieve.pl?doc=fsunone%2F3755
Apache
http://www.htmlhelp.com/faq/html/media.html#garbled-media
