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 "application/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.
Note: Historically, Firefox has loaded CSS files even if they had the wrong MIME type, as long as the HTML document that requested them was being processed in quirks mode. For security reasons, Gecko 2.0 will no longer do this for stylesheets loaded from a different origin than the requesting document. If your stylesheet comes from a different origin than the document, you must serve it with the correct MIME type (
Gecko 220.127.116.11 (Firefox 3.5.11) and Gecko 18.104.22.168 (Firefox 3.6.5) also implement this security fix, but to improve compatibility, there's a temporary heuristic that allows the load if the first line in the style sheet appears to be a well-formed CSS construct.
You need to fix your site; this temporary workaround will go away in Firefox 4.
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.
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!
Changing MIME types on iPlanet/Sun Web Server
The users are presented with a Save As dialog box with the content type set to application/x-pointplus or the CSS file content is displayed as text in the browser when a page includes a Cascading Style Sheets file with the file extension .css.
The file type .css is not mapped to cascading style sheets in the default mime types included with Enterprise Server. You can change the mapping on the Global MIME Types page.
To access this page, from the admin server choose Server Preferences, MIME Types, and set the MIME type for .css to text/css instead of application/x-pointplus.
If the problem persists, turn off keepalive by adding "KeepAliveTimeout 0" to magnus.conf
Based on: SunSolve, Sun Microsystems
Original Document Information
- Author(s): Tristan Nitot
- Last Updated Date: March 18th, 2002
- Copyright © 2001-2003 Netscape.
Interwiki Language Links