简体   繁体   中英

IE8 doesn't load CSS

I have written a new website template. All works fine but there is one problem:

IE8 and lower don't load my stylesheet. I have no idea why. I have tried it on multiple computers to eliminate the possibility of cache-problems or something like that.

The stylesheet is written with SASS (http://sass-lang.com/). But I think, this isn't the problem because I've made some other websites with SASS and everything works fine.

//EDIT:

<!DOCTYPE html>
<html lang="de">
    <head>
        <meta charset="utf-8" />
        <title>***</title>
        <link rel="stylesheet" type="text/css" href="/styles/screen.css" />
    </head>
<body>
</body>
</html>

You are using <section> elements that are new and IE8 doesn't know about by default. And because it doesn't know about them they are treated sort of like a span except you can't style them either using CSS.

The trick is to create the element before the page is is loaded and the browser can style them. The easiest way is to use something like html5shim . Just make sure to add the following code to your head section as it needs to run before the HTML starts rendering:

<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

Some problem in your path I guess..

Possibility 1 :

<link rel="stylesheet" type="text/css" href="styles/screen.css" media="screen" />

Possibility 2 :

<link rel="stylesheet" type="text/css" href="../styles/screen.css" media="screen" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM