浏览器是IE6,加载ie6.css;浏览器是IE7及以上版本,加载ie7.css;浏览器非IE,加载notIEcss.css。
<link href="index2/style2.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]><link href="index2/ie6.css" rel="stylesheet" type="text/css" /><![endif]-->
<!--[if gte IE 7]><link href="index2/ie7.css" rel="stylesheet" type="text/css" /><![endif]-->
<link href="#" id="notIEcssId" rel="stylesheet" type="text/css"/>
<script type="text/javascipt" >
$(document).ready(function(){
//如果浏览器不是ie,加载notIEccss文件
if( ! $.browser.msie) {
$("#notIEcssId").attr("href","notIEcss.css");
});
</script>
本文介绍了一种根据浏览器版本加载不同CSS文件的方法,通过条件注释和JavaScript判断,实现IE6、IE7及以上版本和其他非IE浏览器的样式定制。
7307

被折叠的 条评论
为什么被折叠?



