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

CSS hack区别下列——当心程序与涉猎器CSS HACK位子:
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;bac千克round:blue;笼统*bac千克round:green;_bac公斤round:blue;
区别IE6与IE8:
bac公斤round:orange; /*/bac千克round:blue;/**/
区别IE7与IE8:
bac千克round:orange; /*/background:blue;/**/
区别FF与IE7:
bac公斤round:orange; *bac公斤round:green !important;
区别FF,IE7,IE8,IE6:
background:orange;*bac公斤round:green important;bac公斤round:#111\9;_background:blue; 
梗概运用
区别FF,IE7,IE8,IE6:
bac公斤round:orange;*bac公斤round:green !important;bac千克round:#111\9;*background: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/rumen/r52853.shtml