CSS 将 !important 应用于具有多个选项的字体系列

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10524324/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 03:48:49  来源:igfitidea点击:

Apply !important to font-family with more than one option

css

提问by rauland

How can I apply !important to the following syle:

我如何将 !important 应用于以下 syle:

font-family: "Trebuchet MS" , Verdana, Helvetica, Sans-Serif;  

I've tried this, but doesn't work:

我试过这个,但不起作用:

font-family: "Trebuchet MS" , Verdana, Helvetica, Sans-Serif !important;

采纳答案by Yisela

The code is fine. It would vary depending on which elements you are giving the property to. It's better if you use specific selectors such as classes:

代码没问题。它会根据您将属性提供给哪些元素而有所不同。最好使用特定的选择器,例如类:

http://jsfiddle.net/4d3K4/

http://jsfiddle.net/4d3K4/

回答by daleyjem

Select the children within the parent container with a wildcard (*):

使用通配符 (*) 选择父容器中的子项:

div * {font-family: "Trebuchet MS" , Verdana, Helvetica, Sans-Serif !important; }

http://jsfiddle.net/4d3K4/50/

http://jsfiddle.net/4d3K4/50/