覆盖 IE7 中的内联 CSS 样式
我有一个带有内联 CSS 样式的 html 标签,例如:
我想覆盖它内联位置属性。所以,我写了一个这样的 CSS 规则:body > div[style]{position:relative !important;top:0px !important;}
上面的代码适用于 Firefox。但在 IE7 中则不起作用。我是否遗漏了 IE 的任何内容?
PS:尽管我可以在 Firebug lite 窗口中看到我覆盖的属性,但它不会影响我页面上的任何内容。 (请参阅所附图片)。
I have a html tag with inline CSS style like: <body><div style="position:absolute;top:100px;"></body>
and I want to override this inline position property. So, I wrote a CSS rule like this:
body > div[style]{position:relative !important;top:0px !important;}
The above code works in Firefox. But in IE7 it does not work. Am I missing anything for IE?
PS: Even though I could see my overridden attributes in Firebug lite window, it's not affecting anything on my page. (Plz refer the attached image).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的选择器不需要那么具体 - 我不确定,但我不确定 IE7 是否会理解它。 !important 应该覆盖它。
你试过这个吗?
Your selector doesn't need to be that specific - I'm not sure but I'm not sure IE7 would understand it. The !important should override it.
Have you tried this?
IE7 不支持
style
属性选择器: http://reference.sitepoint .com/css/css3attributeselectorsThe
style
attribute selector is not supported in IE7: http://reference.sitepoint.com/css/css3attributeselectors