CSS没有链接到IE 7和IE 8中的HTML

时间:2012-02-18 00:54:53

标签: css internet-explorer-8 internet-explorer-7

我正在使用几个stlyesheets创建一个响应式网站。在IE 9,Firefox和Safari中一切正常,但是当我在IE 8或更低版本中查看网站时,样式就会消失。

您可以在http://stevepolitodesign.comlu.com/查看该网站(我正在免费托管该网站以进行调试,因此可能会定期关闭)

这是HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Steve Polito Design</title>

<!-- CSS -->
<link href="css/wide.css" rel="stylesheet" type="text/css" media="screen and (min-width: 1501px)" />
<link href="css/layout.css" rel="stylesheet" type="text/css" media="screen and (min-width: 801px) and (max-width: 1500px)" />
<link href="css/medium.css" rel="stylesheet" media="screen and (min-width: 401px) and (max-width: 800px)" />
<link href="css/narrow.css" rel="stylesheet" media="screen and (min-width: 0px) and (max-width: 400px)" />
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="css/iphone.css"/>
<link href="css/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css"  media="screen"/>


<!-- @font-face -->
<link href="fonts/@font-face.css" rel="stylesheet" type="text/css" />

<!-- JS -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing-1.3.pack.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.js"></script>
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="js/site.js"></script>


</head>  

1 个答案:

答案 0 :(得分:0)

media属性是CSS3的一部分,因此IE 6/7/8不支持。有关它的详细信息,请参阅此文章http://nicolasgallagher.com/mobile-first-css-sass-and-ie/

快速解决方案是添加一些链接到css文件的行,这些文件对IE6-8以外的所有文件都是隐藏的。

<!--[if (gt IE 8) | (IEMobile)]><!-->
<link rel="stylesheet" href="/css/style.css">
<!--<![endif]-->
相关问题