如何推翻!重要? [英] How to overrule !important?

查看:182
本文介绍了如何推翻!重要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些html和一些CSS样式注入到第三方网站。但是,由于某些 !important 声明,他们的样式正在与我混淆。

I wrote a bit of html with some css styling injected into a third party site. But, their styling is messing with mine due to some !important declarations. I don't want this, and I don't want to use !important in my styles.

我能做些什么来防止这种情况?

jsFiddle的示例

推荐答案

!重要声明覆盖了所有其他内容,甚至内联样式和更具体的层次结构。覆盖!重要的唯一方法是更具体!重要。

The !important declaration overrides everything else, even inline styles and more specific hierarchy. The only way to override an !important is with an even more specific !important.

这是为什么!重要的应该避免。

And this is why !important should be avoided.

这篇关于如何推翻!重要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆