1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>Document</title>
6
7 <style>
8 h1 { color: red; } /* 0, 0, 0, 1*/
9 body h1 { color: green; } /* 0, 0, 0, 2*/
10
11 h2 { color: red; } /* 0, 0, 0, 1*/
12 h2.test{ color: green; } /* 0, 0, 1, 1*/
13 #test2 { color: yellow; } /* 0, 1, 0, 0*/
14 h2 { color: gray !important; }
15 h2 { color: black !important; }
16
17 /* style 特殊性值为: 1, 0, 0, 0*/
18 /* id 特殊性值为: 0, 1, 0, 0*/
19 /* 属性、属性值或者伪类特殊性值为: 0, 0, 1, 0*/
20 /* 元素特殊性值为: 0, 0, 0, 1*/
21 /* !important超越特殊性值*/
22 /* 相同特殊性值,或者!important,最后出现的起作用*/
23 </style>
24 </head>
25 <body>
26 <h1>12345</h1>
27 <h2 class="test" id="test2" style="color: blue">67890</h2>
28 </body>
29 </html>