CSS Hacker

1、IE条件注释法

 

<!--[if  IE]>

<linke type =”text/css” href=”test.css” rel=”stylesheet” />

<![endif]-->

 

<!--[if  IE  6]>

<linke type =”text/css” href=”test.css” rel=”stylesheet” />

<![endif]-->

 

 

 

<!--[if  !  IE  6]>

<linke type =”text/css” href=”test.css” rel=”stylesheet” />

<![endif]-->

 

 

 

<!--[if  IE  6]>

<style typej=”text/css”>

.test{}

     </style>

<![endif]-->

 

<!--[if  IE  6]>

<script type=”text/Javascript”></script>

<![endif]-->

 

 

 

2、选择符前缀法

 

<style type=”text/css”>

.test{width:80px;}/*IE 6,7,8 */

*html .test{width:60px;}/*only for IE 6*/注意一定是*html打头,其它如*body不能作区分hacker

*+html .test{width:70px;}/*only for IE 7  IE 8 beta*//注意一定是*html打头,其它如*body不能作区分hacker

</style>

注意:IE 910不识别;不能用于内联样式;

注意:*+html 对IE7的HACK 必须保证HTML顶部有如下声明:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” ”http://www.w3.org/TR/html4/loose.dtd”

以上是 网上说的,经本人测试html5标准也可以*+html



3、样式属性前缀法

 

<style type=”text/css>

.test{

width:80px;

*width:70px;/*for IE67;还可以是#或者+*/

_width:60px;/*for IE 6*/

color:red\0;/*IE 8 only*/

Color:red\9;/*ALL IE*/
 [;background-color:green;]/*safari, chrome*/

}

 

 

区别 FF, IE7, IE6: 

background:orange;*background:green !important;*background:blue; 

 

注:IE都能识别*;标准浏览器(FF)不能识别*

IE6能识别*,但不能识别 !important,

IE7能识别*,也能识别!important;

FF不能识别*,但能识别!important; 

 

IE6

IE7

FF

*

×

!important

×

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值