fixed-table-layout-019.xht (1888B)
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 and predicted when in 'border-collapse: separate' model." 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#third-cell {color: orange;} 36 37 div, td {padding: 1px 0px;} 38 39 div#reference 40 { 41 background-color: blue; 42 color: blue; 43 left: 172px; 44 position: relative; 45 width: 160px; 46 47 /* 48 49 422px : total width of table 50 - 51 12px : total width of horizontal borders of table 52 - 53 10px : 5 times horizontal border-spacing 54 ======== 55 400px 56 mult by 57 40% 58 ======== 59 160px 60 61 */ 62 } 63 ]]></style> 64 65 </head> 66 67 <body> 68 69 <p>Test passes if the orange stripe is exactly as wide as the blue stripe and is horizontally positioned the same.</p> 70 71 <table> 72 73 <col></col> 74 <col></col> 75 <col id="test"></col> 76 <col></col> 77 78 <tr> 79 <td></td> 80 <td></td> 81 <td id="third-cell">col</td> 82 <td></td> 83 </tr> 84 85 </table> 86 87 <div id="reference">ref</div> 88 89 </body> 90 </html>