CSS 样式重载
在此图像中,我希望将 #bf0018 作为属性 color 的值
谁能帮我......
In this image I want to have #bf0018 as the value of the property colour
Can anyone help me ....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您必须了解 CSS 层次结构。包含此颜色的文件必须位于包含同一类的不同颜色的其他文件下方。如果同一类的同一文件中有许多颜色属性,则“正确”的属性必须是最后一个,以覆盖其余属性。如果您无法更改文档中的文件位置,或者您不想更改 css 文件的结构,您可以添加
!important
接下来是类似.highlight {color: #bf0018 !important;}
的值,但是这是最后一个建议。You have to understand CSS hierarchy. The file that contains this color, must be below the other files that contains different color for the same class. If there are many color properties in the same file for the same class, then the the "correct" one must me the last, to override the rest. In case that you can't change file positions in the document, or you don't want to change the structure of css files, you can add
!important
next the value like.highlight {color: #bf0018 !important;}
but this is the last suggestion.我不认为您应该使用
!important
。从长远来看,使用!important
很可能会弄乱您的样式。相反,请阅读 css 特异性。两个信息来源:在您的示例中,您不能打开typography.css并更改价值?您不应该按照其他答案中的建议使用
!important
。I don't think you should use
!important
. Using!important
will most likely mess up your styling in the long run. Instead read on css specificity. Two sources of information:In your example can't you open typography.css and change the value? You shouldn't use
!important
as suggested in other answers.最后加载 TResWinIE 样式表,以便声明位于最后,或者将 !important 添加到 TResWinIE 样式表中的规则,使其看起来像这样:
Either load your TResWinIE stylesheet last so that the declaration comes last, or add !important to the rule in the TResWinIE stylesheet so it looks like so:
您应该使用 !important 关键字来覆盖所有其他样式
You should use !important keyword to override all the other styles