Solving CSS Stylesheet Not Loading / Rendering Error
By Angsuman Chakraborty, Gaea News NetworkTuesday, July 3, 2007
My blog had this vexing problem where it used to render ugly, really ugly, as the stylesheet wasn’t being loaded on Firefox. However after a refresh everything was fine. Even the Alexa thumbnail displayed the front page in all its css-less ugliness. Initially I thought it was a temporary file loading error. I also reduced the number of Javascripts on the page. None of them could solve the problem. Finally today, when I was debugging a project using Firebug, I noticed the actual problem.
The stylesheet was not being loaded simply because the file type returned by the web server was text/plain instead of the required type - text/css. The solution was simple. I added the following to httpd.conf and restarted the server: - The solution here doesn’t work because the problem is elsewhere, with mod_cache.
AddType text/css .css
The temporary solution is to add the style.css to DisableCache directive in the virtual host configuration section (or in the main section). The permanent solution is to update Apache. This is a documented mod_cache defect.
Thanks to Firebug for helping me solve this problem.
Note: Internet Explorer did render fine even with this error.
February 18, 2010: 5:53 am
Thanks! You pointed me in the right direction! For some reason, IIS had the MIME defaults correct on the server, but on my specific site everything was sent back as octetstream. I added a .ccs = text/css mime type to my site and then everything worked just fine! |
wtk |
October 3, 2009: 11:56 am
I have had similar problem with rendering website. Solution was to check css - there were comments that were spoiling whole css loading process. Css Validator didn’t even notice that.. |
Ghodmode |
July 17, 2007: 3:47 pm
Thank you for pointing me in the right direction to solve this problem. I figured it might have something to do with the cache. I think you have a slight error, though. I wasn’t able to find a DisableCache directive in the documentation, but I found CacheDisable https://httpd.apache.org/docs/2.0/mod/mod_cache.html#cachedisable Thank you, |
Niall O'Meara |
July 3, 2007: 8:50 am
Hello, I’m sorry to say that it appears that your style sheet is not being loaded when using Firefox. |
Henrik Weimenhög