|
|
长情的企鹅 · 查看和更改 CSS 入门 - ...· 1 月前 · |
|
|
怕老婆的大熊猫 · Dart对列表进行排序-阿里云开发者社区· 2 年前 · |
|
|
有腹肌的豆腐 · angular5 - Angular 5 ...· 2 年前 · |
|
|
腹黑的饭卡 · [解决]RESTEASY003215: ...· 2 年前 · |
|
|
英俊的铁板烧 · 这些掌握了,你才敢说自己懂VBA ...· 2 年前 · |
我有使用内联样式的标记,但我没有权限更改此标记。如何仅使用CSS覆盖文档中的内联样式?我不想使用jQuery或JavaScript。
HTML:
<div style="font-size: 18px; color: red;">
Hello World, How Can I Change The Color To Blue?
</div>
CSS:
div {
color: blue;
/* This Isn't Working */
}
除了内联
!important
样式之外,您可以很容易地覆盖内联样式
所以
<div style="font-size: 18px; color: red;">
Hello World, How Can I Change The Color To Blue?
div {
color: blue !important;
/* This will Work */
}
但是如果你有
<div style="font-size: 18px; color: red !important;">
Hello World, How Can I Change The Color To Blue?
div {
color: blue !important;
/* This Isn't Working */
}
现在它将仅为
red
..你不能重写它
<div style="background: red;">
The inline styles for this div should make it red.
div[style] {
background: yellow !important;
}
以下是更多详细信息的链接: http://css-tricks.com/override-inline-styles-with-css/
|
|
怕老婆的大熊猫 · Dart对列表进行排序-阿里云开发者社区 2 年前 |