欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

CSS hack:甄别IE6,IE7 ,IE8,firefox
区别一致浏览器,CSS hack写法:
区别FF与IE6:
bac公斤round:orange;*background:blue; 表述:FF只能辨认bac公斤round:orange; IE6识别*bac公斤round:blue; 
区别IE7与IE6:
bac千克round:green !important;background:blue;也许*bac公斤round:green;_background:blue;
区别IE6与IE8:
bac千克round:orange; /*/bac公斤round:blue;/**/
区别IE7与IE8:
background:orange; /*/bac公斤round:blue;/**/
区别FF与IE7:
bac千克round:orange; *background:green !important;
区别FF,IE7,IE8,IE6:
bac千克round:orange;*background:green important;bac千克round:#111\9;_bac公斤round:blue; 
概略使用
区别FF,IE7,IE8,IE6:
bac千克round:orange;*bac千克round:green !important;background:#111\9;*bac千克round:blue;

CSS Hack实例例子:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DIV+CSS各阅读器css hack测试,css5.com.cn测试</title>
<style type="text/css">
<!--
.STYLE1 { font-size:18px;color:#FF0000;*color:#00FF00 !important;color:#0000FF \9;*color:#FFFF00;}
.STYLE2,.STYLE3,.STYLE4,.STYLE5{ font-size:14px;}
.STYLE2 {color: #FFFF00}
.STYLE3 {color: #FF0000}
.STYLE4 {color: #00FF00}
.STYLE5 {color: #0000FF}
-->
</style>
</head>
<body>
<span class="STYLE1">我是测试颜色,不在不合浏览器下表现色彩差异哦!-<a href="//www.css5.com.cn/">DIV+CSS</a></span><br />

<span class="STYLE2">我是色彩在IE6闪现</span> <br />
<span class="STYLE4">我是色采在ie7显露</span> <br />
<span class="STYLE5">我是颜色在ie8浮现</span> <br />
<span class="STYLE3">我是色彩在火狐(firefox)展示</span>
</body>
</html>

在线演示-点击这里
以上代码你拷贝到一个新建的html文件在一致版本阅读器测试就会有差异成绩。运用此例子便可操持咱们在日常DIV+CSS开荒时候的css hack标题。

同时咱们要是不想那么的穷苦来做IE8的css hack,咱们只紧要在html的<head></head>之间插手<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />,最好加到CSS文件下发就可,在IE8 下与IE7下显示内容类似,何等咱们只有辨别IE6、IE7、火狐(firefox)的css hack即可。不少大型站点都采纳在head退出此代码来削减css 漏洞。

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/shili/s52491.shtml