first-child-000

Selectors: The :first-child pseudo-class

WeasyPrint

This browser

Assertion
Browsers should apply each rule to the element which is the first child of its parent

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: Selectors: The :first-child pseudo-class</title>
 5   <link rel="author" title="Gabriele Romanato" href="mailto:gabriele.romanato@gmail.com">
 6   <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#first-child">
 7   <meta name="flags" content="">
 8   <meta name="assert" content="Browsers should apply each rule to the element which is the first child of its parent">
 9 <style type="text/css">
10 * {color: silver}
11 em:first-child {color: fuchsia;}
12 div:first-child {color: orange;}
13 span:first-child {color: blue}
14 </style>
15  </head>
16  <body>
17 <p><em>This text should be fuchsia.</em> Filler text.</p>
18 <div><div>This text should be orange.</div> <p>Filler text.</p></div>
19 <h4><span>This text should be blue.</span> <span>Filler text.</span></h4>
20  </body>
21 </html>