c32-cascading-000

Cascading Order

WeasyPrint

This browser

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3  <head>
 4   <title>CSS Test: Cascading Order</title>
 5   <link rel="help" href="http://www.w3.org/TR/REC-CSS1#cascading-order">
 6   <link rel="author" title="CSS1 Test Suite Contributors" href="http://www.w3.org/Style/CSS/Test/CSS1/current/tsack.html">
 7   <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
 8   <link rel="stylesheet" href="support/c-red.css">
 9   <style type="text/css">
10    body * { color: red; list-style: none; margin: 0; padding: 0; }
11    span { color: red; }
12    li span.a { color: red; }
13    li span.b { color: red; }
14    li span.c { color: red; }
15    li span.d { color: red; }
16    li span.e { color: red; }
17    li span.f { color: red; }
18    ul li span.a { color: green; }
19    ul li span.b { color: green; }
20    ul li li span.c { color: red; }
21    ul li li span.d { color: red; }
22    ul li li span.e { color: red; }
23    ul li li span.f { color: red; }
24    ul li li span.c { color: green; }
25    li.test1 span.d { color: green; }
26    ul li.test2 span.e { color: green; }
27    ul li.test3 span.f { color: red; }
28    ul li#test3 span.f { color: green; }
29    .test4 { color: red; }
30    .test4 { color: green; }
31    .c { color: green; }
32   </style>
33   <link rel="help" href="http://www.w3.org/TR/CSS21/cascade.html#cascading-order" title="6.4.1 Cascading order">
34   <link rel="help" href="http://www.w3.org/TR/CSS21/cascade.html#specificity" title="6.4.3 Calculating a selector's specificity">
35  </head>
36  <body>
37   <ul>
38    <li> <span class="a"> This should be green. </span> </li>
39    <li> <span class="b"> This should be green. </span>
40     <ul>
41      <li> <span class="c"> This should be green. </span> </li>
42      <li> <span class="c"> This should be green. </span> </li>
43      <li class="test1"> <span class="d"> This should be green. </span> </li>
44     </ul>
45    </li>
46    <li class="test2"> <span class="e"> This should be green. </span> </li>
47    <li class="test3" id="test3"> <span class="f"> This should be green. </span> </li>
48    <li> <span class="a"> This should be green. </span> </li>
49   </ul>
50   <p style="color: green;"> This should be green. </p>
51   <p class="test4"> This should be green. </p>
52   <p class="c"> This should be green. </p>
53  </body>
54 </html>