specificity-002

Calculating specificity - Inline Style

WeasyPrint

This browser

Assertion
Specificity of the inline style trumps all other selectors.

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: Calculating specificity - Inline Style</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/cascade.html#specificity">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="Specificity of the inline style trumps all other selectors.">
 9         <meta http-equiv="Content-Style-Type" content="text/css">
10         <style type="text/css">
11             #id1 /* a=0 b=1 c=0 d=0 -> specificity = 0,1,0,0 */
12             {
13                 color: red;
14             }
15             div:first-child /* a=0 b=0 c=1 d=1 -> specificity = 0,0,1,1 */
16             {
17                 color: red;
18             }
19         </style>
20     </head>
21     <body>
22         <p>Test passes if the "Filler Text" below is green.</p>
23         <div id="id1" style="color: green">Filler Text</div>
24     </body>
25 </html>