separated-border-model-004a.xht (2193B)
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: width of CSS table in border-collapse separate model</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#separated-borders" title="17.6.1 The separated borders model" /> 11 <link rel="match" href="../reference/ref-filled-green-100px-square.xht" /> 12 13 <meta content="The width of a CSS table is the distance from the left inner padding edge to the right inner padding edge (including the table border-spacing but excluding table padding and table borders)." name="assert" /> 14 15 <style type="text/css"><![CDATA[ 16 div#overlapped-red 17 { 18 background-color: red; 19 height: 100px; 20 left: auto; 21 position: absolute; 22 top: auto; 23 width: 100px; 24 z-index: -1; 25 } 26 27 div#table 28 { 29 background-color: green; 30 border-spacing: 2px 5px; 31 color: green; 32 display: table; 33 font: 20px/1 serif; 34 padding-top: 5px; 35 table-layout: fixed; 36 width: 100px; 37 /* 38 The set width (100px) is larger than sum of columns' width plus cell spacing 39 40 2px : left-most border-spacing 41 + 42 40px : div.td's width: leftmost cell width in first row) 43 + 44 2px : middle border-spacing 45 + 46 40px : div.td's width: rightmost cell width in first row) 47 + 48 2px : right-most border-spacing 49 ====== 50 86px : sum of columns plus cell spacing 51 52 53 100px : set width of table 54 - 55 86px : sum of columns plus cell spacing 56 ====== 57 14px : such extra (exceeding) 14px width will be distributed over 58 the columns. 59 */ 60 } 61 62 div.tr {display: table-row;} 63 64 div.td {display: table-cell;} 65 ]]></style> 66 67 </head> 68 69 <body> 70 71 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 72 73 <div id="overlapped-red"></div> 74 75 <div id="table"> 76 <div class="tr"> 77 <div class="td">11<br />11</div><div class="td">22<br />22</div> 78 </div> 79 <div class="tr"> 80 <div class="td">33<br />33</div><div class="td">44<br />44</div> 81 </div> 82 </div> 83 84 </body> 85 </html>