table-columns-example-002.xht (1630B)
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: Table columns - Assigning a background to a column</title> 5 <link rel="author" title="W3C" href="http://www.w3c.org" /> 6 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#columns" /> 8 <meta name="assert" content="A specific column class can be selected for a blue background (example from section 17.3)." /> 9 <style type="text/css"> 10 table 11 { 12 border-collapse: collapse; 13 } 14 col 15 { 16 border-style: solid; 17 } 18 col.totals 19 { 20 background: blue; 21 } 22 td 23 { 24 border: 1px solid black; 25 height: 2em; 26 width: 2em; 27 } 28 </style> 29 </head> 30 <body> 31 <p>Test passes if the middle column of the three-by-three grid is blue.</p> 32 <table> 33 <col /> 34 <col class="totals" /> 35 <col /> 36 <tr> 37 <td></td> 38 <td></td> 39 <td></td> 40 </tr> 41 <tr> 42 <td></td> 43 <td></td> 44 <td></td> 45 </tr> 46 <tr> 47 <td></td> 48 <td></td> 49 <td></td> 50 </tr> 51 </table> 52 </body> 53 </html>