selector{property:value; /*所有浏览器*/property:value\9; /*所有IE浏览器*/
+property:value; /* IE7 */
_property
当然注意顺序。根据CSS的优先性上面的写法分别针对Firefox、 IE8、 IE7和IE6显示值。让我们看看这个
CSS代码如下p. ie{height:60px;text-align:center; line-height:60px;border: 1px dashed
#bbb;background:#f7f7f7;font: 15;color:blue; //所有浏览器color:brown\9; //所有IE浏览器
+color:red; // IE7
_color:green; // IE6
}
HTML代碼
<body style="width:500px;margin:0 auto;">
<p class="ie">
<span style="display:block;display:none\9;">嘿嘿小子竟然也用Firefox蓝色文字。
</span>
<!--[if IE 8]>不错不错挺先进的嘛使用IE8呢文字是褐色的。 <! [endif]--><!--[if IE 7]>你 IE7红色文字 <! [endif]-->
<!--[if IE 6]>孩子虽然显示的是绿色文字不过 IE6可不是好东西呢 <! [endif]--></p>
</body>
注意下面介绍的这些hack写法仅适用于XHTML1.0。如果没有在HTML最前加上
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml">
那么效果将不一样此外这里所说的IE8不是指IE8的兼容模式因为IE8的兼容模式其实就是IE7。
区别IE6、 7与FF/IE8background:blue;*background:orange;
引用
显示效果
IE 6/7 orange
FF/IE8:blue
原理 FF/IE8不支持*开头而IE6/7都支持。
区别IE6与IE7/IE8/FFbackground:green;_background:blue;
引用
显示效果
IE7/8/FF green
IE6:blue
原理 IE6支持下划线"_" IE7、 8和firefox均不支持下划线。区别FF/IE8和IE6/7background:orange;+background:green;-background:blue;
或者background:orange;*background:green! important;*background:blue;引用
显示效果
IE6 blue
IE7 green
FF/IE8:orange
原理 IE6能识别- IE7能识别+ IE8和FF都不能识别+和-
IE8/FF都不识别* IE7优先识别! important IE6不能识别! important。关于IE8的hacks
. test{color:/*\**/#00f\9; /* IE8 only */color:#00f\9; /*适用于所有IE版本*/
}
可同时区分IE8、 IE7、 IE6、 Firefox的CSS hacks
. test{color:#000; /* Firefox */color:/*\**/#00f\9; /* IE8 */
*color:#f00; /* IE7 */
_color:#0f0; /* IE6 */
}
添加相应的注释解决兼容性问题
注释相应的Css文件
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" /><!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="css/IE6style.css" media="screen" /><! [endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="css/IE7style.css" media="screen" /><! [endif]-->
<!--[if gte IE 8]>
<link rel="stylesheet" type="text/css" href="css/IE8style.css" media="screen" />
<! [endif]-->
注释相应的Css 内容
<!--[if ie 6]>
<style>
<!--
#warp{ padding-bottom: 11px; }-->
</style>
<! [endif]-->
<!--[if ie 7]>
<style>
<!--
#warp{ padding-bottom: 11px; }
-->
</style>
<! [endif]-->
<!--[if ie 8]>
<style>
<!--
#warp{ padding-bottom: 11px; }-->
</style>
<! [endif]-->
IMIDC发布了6.18大促销活动,针对香港、台湾、日本和莫斯科独立服务器提供特别优惠价格最低月付30美元起。IMIDC名为彩虹数据(Rainbow Cloud),是一家香港本土运营商,全线产品自营,自有IP网络资源等,提供的产品包括VPS主机、独立服务器、站群独立服务器等,数据中心区域包括香港、日本、台湾、美国和南非等地机房,CN2网络直连到中国大陆。香港服务器 $39/...
前些天赵容分享过DogYun(狗云)香港BGP线路AMD 5950X经典低价云服务器的信息(点击查看),刚好账户还有点余额够开个最低配,所以手贱尝试下,这些贴上简单测试信息,方便大家参考。官方网站:www.dogyun.com主机配置我搞的是最低款优惠后14.4元/月的,配置单核,512MB内存,10GB硬盘,300GB/50Mbps月流量。基本信息DogYun的VPS主机管理集成在会员中心,包括...
Hostinger 商家我们可能一些新用户不是太熟悉,因为我们很多新人用户都可能较多的直接从云服务器、独立服务器起步的。而Hostinger商家已经有将近十年的历史的商家,曾经主做低价虚拟主机,也是比较有知名度的,那时候也有接触过,不过一直没有过多的使用。这不这么多年过去,Hostinger商家一直比较稳妥的在运营,最近看到这个商家在改版UI后且产品上也在活动策划比较多。目前Hostinger在进...