External CSS won’t load in IE7

I just spent a while wondering why IE7 wouldn’t make use of an external stylesheet when it worked in Firefox no problems.

The page is in UTF-8 and the .css file was also encoded in UTF-8 but IE7 simply refused to render the page using the CSS rules.

I have no idea  what the problem is but if you are having similar issues try putting @charset “UTF-8″; at the top of your external stylesheet – it worked for me.

Does anyone know what the underlying issue is?

  • http://www.arkayne.com pkenjora

    I had similar issues for a while, my solution was to include the W3C header at the top of my pages.

    I think strict is preferred but I needed loose for some weird css or something.

  • Daniel Skinner

    Yes, it’s strange. Actually, I ended up taking @charset “UTF-8″; out in the end as it invalidated the CSS file.

    Yeah, strict doctypes can have an effect on the CSS, for example, the box model. However, I have always found less issues when coding to strict.

  • http://thereturnvalue.com eranio

    i have the same issue – site looks good in all browsers – except IE7.
    what solved my problem was to change the DOCTYPE from XHTML 1.0 strict
    to: HTML 4.01 and it solves the problem.

    look at: