坑货IE啊,开发的过程中被迫不得不寻求各种奇葩HACK方式。这次IE8和IE7又杠上了,规则总是冲突。为此想出以下这套方案兼容各版本。给位放心的去用吧。
css代码
.no-pd .header_search .sub_yellow {
background: url("../../images/b-search.png") no-repeat 0 0;
width: 58px;
height: 28px;
position: absolute;
right: 0;
top: 2px; /* 结合下面的媒体查询,剩下的低版本ie7-8*/
_top:1px; /*ie6*/
}
/*>ie9 and chrome*/
@media screen and (min-width:0px) {
.no-pd .header_search .sub_yellow{
top:0;
}
}
汇总下IE各版本的css hack。
| hack | 示例 | IE6(S) | IE6(Q) | IE7(S) | IE7(Q) | IE8(S) | IE8(Q) |
| * | *color | Yes | Yes | Yes | Yes | No | Yes |
| + | +color | Yes | Yes | Yes | Yes | No | Yes |
| - | -color | Yes | Yes | No | No | No | No |
| _ | _color | Yes | Yes | No | Yes | No | Yes |
| # | #color | Yes | Yes | Yes | Yes | No | Yes |
| \0 | color\0 | No | No | No | No | Yes | No |
| \9 | color\9 | Yes | Yes | Yes | Yes | Yes | Yes |
| !important | color:blue !important; color:green; | No | No | Yes | No | Yes | No |
标准模式中:
1,减号(-)是IE6专有hack
2,反斜杠零(\0)是IE8专有hack
版权声明:本文为lucyyang2008原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。