selectors-001

CSS Selectors (basic)

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: CSS Selectors (basic)</title>
 5   <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
 6   <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/selectors/001.html" type="text/html">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/selector.html#pattern-matching">
 8   <style type="text/css">
 9    body * { background: red; color: yellow; margin: 1em 0; font: inherit; display: block; }
10    p { background: green; color: white; }
11    .class { background: green; color: white; }
12    #id { background: green; color: white; }
13    div span { background: green; color: white; }
14    div > em { background: green; color: white; }
15    div + blockquote { background: green; color: white; }
16    [title=attribute] { background: green; color: white; }
17   </style>
18  </head>
19  <body>
20   <p>This text should be green. (element)</p>
21   <div class="class">This text should be green. (class)</div>
22   <div id="id">This text should be green. (id)</div>
23   <div><em>This text should be green. (child)</em></div>
24   <div><span>This text should be green. (descendant)</span></div>
25   <blockquote>This text should be green. (sibling)</blockquote>
26   <div title="attribute">This text should be green. (attribute)</div>
27  </body>
28 </html>