height-width-table-001e.xht (2241B)
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: height and width of element set to 'display: table'</title> 8 9 <!-- 10 Inspired by 11 http://test.csswg.org/suites/css2.1/20101210/html4/empty-cells-applies-to-007.htm 12 --> 13 14 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 15 <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#height-layout" title="17.5.3 Table height algorithms" /> 16 <link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2011Jan/0178.html" title="[CSS21] Question on section 17.6.1 The separated borders model and width of inline-table" /> 17 <link rel="match" href="../reference/ref-filled-green-100px-square.xht" /> 18 19 <meta content="The content-box height and width of an empty element styled with display set to 'table' is given by its height and width properties when specified." name="assert" /> 20 21 <style type="text/css"><![CDATA[ 22 div#overlapped-red-reference 23 { 24 background-color: red; 25 height: 100px; 26 position: absolute; 27 width: 100px; 28 z-index: -1; 29 } 30 31 div#overlapping-green-test 32 { 33 background-color: green; 34 border-bottom: green solid 12px; 35 border-left: green solid 14px; 36 border-right: green solid 16px; 37 border-top: green solid 18px; 38 border-collapse: separate; 39 display: table; 40 height: 33px; 41 padding: 20px 22px 17px 15px; 42 width: 33px; 43 } 44 45 /* 46 height of border-box calculation 47 -------------------------------- 48 49 18px (border-top) 50 + 51 20px (padding-top) 52 + 53 33px (content height) 54 + 55 17px (padding-bottom) 56 + 57 12px (border-top) 58 ----------------------- 59 100px 60 61 62 width of border-box calculation 63 ------------------------------- 64 65 14px (border-left) 66 + 67 15px (padding-left) 68 + 69 33px (content width) 70 + 71 22px (padding-right) 72 + 73 16px (border-right) 74 ---------------------- 75 100px 76 */ 77 ]]></style> 78 79 </head> 80 81 <body> 82 83 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 84 85 <div id="overlapped-red-reference"></div> 86 87 <div id="overlapping-green-test"></div> 88 89 </body> 90 </html>