css - 这个 IE 和 IE6 hack 只用 CSS?

标签 css internet-explorer

<!--[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 实现。

最佳答案

要欺骗 IE6,只需在任何属性前加上“_”,例如

   #botonHome .contButton p a span input{  _display: inline; _margin:0px; _padding:0px; _bottom:0px; _height:20px; }

更新:

点击此链接获取 css IE hacks

关于css - 这个 IE 和 IE6 hack 只用 CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6995245/

相关文章:

css - 重置后将 OL 填充设置回默认值

javascript - IE7 : call is undefined on document. AttachEvent函数

javascript - IE 是唯一不允许 Flash 对象操作的浏览器(或版本)吗?

html - 底部对齐一个 float 的 div。 ( 图像 )

css - 选择第一个元素但不包括其他元素内的元素

javascript - 使用 Javascript 添加/删除表格行

html - 在移动设备上将水平形式转换为垂直形式

css - Nav 适用于除 IE11 以外的所有 IE 版本

css - IE 不遵守 :hover on element

javascript - 更改 IE 中脚本标签的innerHTML以显式加载google plusone按钮