<!--[if IE]>
<style type="text/css">
#botonHome .contButton p a span{ height:25px; }
#botonHome .contButton p a span input{ position: relative; bottom:5px; }
</style>
<![endif]-->
<!--[if IE 6]>
<style type="text/css">
#botonHome .contButton p a span input{ display: inline; margin:0px; padding:0px; bottom:0px; height:20px; }
</style>
<![endif]-->最终,我能够在所有浏览器中正确地显示一个按钮,但我不希望在我的html文件中使用这个内联代码。如何仅使用CSS为IE解决这种不同的CSS实现?
发布于 2011-08-09 19:13:09
要欺骗IE6,只需将"_“放在任何属性之前,例如
#botonHome .contButton p a span input{ _display: inline; _margin:0px; _padding:0px; _bottom:0px; _height:20px; }更新:
请访问css IE hacks的此链接
发布于 2011-08-09 19:24:00
对于IE 6,在每个样式之前使用_下划线符号;对于IE 7,在每个样式之前使用*星形符号;对于IE8和IE9,在使用;分号符号结束样式之前使用\0/。代码见下文。
#botonHome .contButton p a span input {
/*For IE 6*/
_display: inline;
_margin:0px;
_padding:0px;
_bottom:0px;
_height:20px;
/*For IE 7*/
*display: inline;
*margin:0px;
*padding:0px;
*bottom:0px;
*height:20px;
/*For IE 8 & 9*/
display: inline\0/;
margin:0px\0/;
padding:0px\0/;
bottom:0px\0/;
height:20px\0/;
}发布于 2011-08-09 19:14:46
这些条件注释对于IE变通方法非常方便。我将使用它们,但不是为了包含style元素,而是为了包含一个css文件。这样,您不必将整个样式添加到每个页面,并且可以更容易地添加其他调整。
https://stackoverflow.com/questions/6995245
复制相似问题