doc: add conflicting rules section
This commit is contained in:
1 parent
a057177285
commit
1bb323a85a
1 file changed
+20
@@ -111,3 +111,23 @@ a.some-link { color: white; } /* 有些特定的 */
|
|||||||
a#my-link { color: blue; } /* 非常具体的 */
|
a#my-link { color: blue; } /* 非常具体的 */
|
||||||
```
|
```
|
||||||
即使稍后出现不太具体的规则,也是如此。
|
即使稍后出现不太具体的规则,也是如此。
|
||||||
|
|
||||||
|
## 冲突规则
|
||||||
|
这是CSS中“级联”的一个重要部分:就像水从边缘滑落一样,最终都在底部形成一个水池,但有些水滴会在其他水滴之前到达那里。
|
||||||
|
|
||||||
|
假设我们有一下的规则:
|
||||||
|
```html
|
||||||
|
<p id="text">
|
||||||
|
Hello World!
|
||||||
|
</p>
|
||||||
|
```
|
||||||
|
|
||||||
|
```css
|
||||||
|
p {
|
||||||
|
color: blue;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
那现在,我们的Hello World会是怎么样的呢?自己可以尝试一下
|
||||||
Reference in new issue
Block a user