table-columns-example-003.xht (1439B)
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 fixed size 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 width can be set on a table column (modified example from section 17.3)." /> 9 <style type="text/css"> 10 #reference 11 { 12 background: blue; 13 height: 1em; 14 width: 100px; 15 } 16 table 17 { 18 background: black; 19 table-layout: fixed; 20 width: 50px; 21 } 22 col.totals 23 { 24 width: 100px; 25 } 26 </style> 27 </head> 28 <body> 29 <p>Test passes if both bars below are the same width.</p> 30 <table cellspacing="0"> 31 <col class="totals" /> 32 <tr> 33 <td>X</td> 34 </tr> 35 <tr> 36 <td>X</td> 37 </tr> 38 <tr> 39 <td>X</td> 40 </tr> 41 </table> 42 <div id="reference"></div> 43 </body> 44 </html>