您的位置:首页 > Web前端 > CSS

针对于ie不同版本的引入相对应的css样式

2014-07-01 11:29 134 查看
一。根据不同浏览器的引入不同的css文件

对ie6-8在html中添加no-css3类和各个版本的class,对ie7以下添加lte7这个class。

<!DOCTYPE HTML>
<!--[if IE 6]><html class="ie6 lte9 lte7 no-css3" lang="zh-cn"><![endif]-->
<!--[if IE 8]><html class="ie8 lte9 no-css3" lang="zh-cn"><![endif]-->
<!--[if IE 9]><html class="ie9 lte9 no-css3" lang="zh-cn"><![endif]-->
<!--[if IE 7]><html class="ie7 lte9 lte7 no-css3" lang="zh-cn"><![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8) | !(IE 9)  ]><!--><html lang="zh-cn"><!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>标题</title>
</head>

<body>

</body>
</html>


二。判断浏览器,添加所需文件

//为ie6-8添加一个ie.css文件
<!--[if lte IE 8]><link href="css/ie.css" type="text/css" rel="stylesheet" media="all"><![endif]-->
//为ie6添加处理png的js文件
<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG_0.0.8a-min.js?_v=<%=JS_VERSION%>"></script>
<script type="text/javascript">
//给所有需要处理的png图片加上dd-pngifx这个class,就可以处理了
DD_belatedPNG.fix(".dd-pngfix");
</script>
<![endif]-->


参考:http://www.w3cplus.com/framework/index.php
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐