如何覆盖已经具有!important的CSS Background? [英] How to override CSS Background that already has !important?
本文介绍了如何覆盖已经具有!important的CSS Background?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用时尚"替换网站的背景,但无法正常工作. 该网站的背景CSS也具有!important重要性,并且它已覆盖时尚".
I am trying to override a website's background with Stylish but it isn't working. The background css for the website also has an !important, and it is overriding Stylish.
我的代码:
body {
background-image: none !important;
background: black !important;
}
推荐答案
您需要更加具体(快速了解CSS特异性指南),例如,使用>
选择器:
You'll need to be more specific (quick guide to CSS specificity), for instance, using the >
selector:
body {
background-image: none !important;
background: black !important;
}
html > body {
background-image: none !important;
background: red !important;
}
这篇关于如何覆盖已经具有!important的CSS Background?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文