fixed-table-layout-020.xht (1869B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Test: table-layout fixed - columns with percentage width</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout" title="17.5.2.1 Fixed table layout" /> 11 <link rel="match" href="fixed-table-layout-017-ref.xht" /> 12 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 13 14 <meta content="A column with a percentage width in a 'table-layout: fixed' table can be calculated, predicted, rendered." name="assert" /> 15 16 <style type="text/css"><![CDATA[ 17 table, div {font: 1.25em/1 Ahem;} 18 19 table 20 { 21 border: white solid; 22 border-width: 0px 6px; 23 border-collapse: separate; 24 border-spacing: 2px 4px; 25 table-layout: fixed; 26 width: 422px; 27 } 28 29 col#test 30 { 31 background-color: orange; 32 width: 40%; 33 } 34 35 td {padding: 1px 30px;} 36 37 td#third-cell {color: orange;} 38 39 div#reference 40 { 41 background-color: blue; 42 color: blue; 43 left: 172px; 44 padding: 1px 0px; 45 position: relative; 46 width: 160px; 47 48 /* 49 50 422px : total width of table 51 - 52 12px : total width of horizontal borders of table 53 - 54 10px : 5 times horizontal border-spacing 55 ======== 56 400px 57 mult by 58 40% 59 ======== 60 160px 61 62 */ 63 } 64 ]]></style> 65 66 </head> 67 68 <body> 69 70 <p>Test passes if the orange stripe is exactly as wide as the blue stripe and is horizontally positioned the same.</p> 71 72 <table> 73 74 <col></col> 75 <col></col> 76 <col id="test"></col> 77 <col></col> 78 79 <tr> 80 <td></td> 81 <td></td> 82 <td id="third-cell">col</td> 83 <td></td> 84 </tr> 85 86 </table> 87 88 <div id="reference">ref</div> 89 90 </body> 91 </html>