selectors-001.xht (1451B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 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 <link rel="match" href="selectors-001-ref.xht"/> 9 <style type="text/css"> 10 body * { background: red; color: yellow; margin: 1em 0; font: inherit; display: block; } 11 p { background: green; color: white; } 12 .class { background: green; color: white; } 13 #id { background: green; color: white; } 14 div span { background: green; color: white; } 15 div > em { background: green; color: white; } 16 div + blockquote { background: green; color: white; } 17 [title=attribute] { background: green; color: white; } 18 </style> 19 </head> 20 <body> 21 <p>This text should be green. (element)</p> 22 <div class="class">This text should be green. (class)</div> 23 <div id="id">This text should be green. (id)</div> 24 <div><em>This text should be green. (child)</em></div> 25 <div><span>This text should be green. (descendant)</span></div> 26 <blockquote>This text should be green. (sibling)</blockquote> 27 <div title="attribute">This text should be green. (attribute)</div> 28 </body> 29 </html>