block-non-replaced-width-001.xht (1906B)
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: Solving for width of block-level non-replaced elements in normal flow</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-09-29 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth" /> 8 <link rel="match" href="block-non-replaced-width-001-ref.xht" /> 9 10 <meta name="assert" content="The equation; 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' is equal the width of containing block." /> 11 <style type="text/css"> 12 #div1 13 { 14 background-color: orange; 15 border: 5px solid orange; 16 display: inline-block; 17 } 18 div div 19 { 20 background-color: orange; 21 border-left: 10px solid orange; 22 border-right: 10px solid orange; 23 height: 20px; 24 margin-left: 10px; 25 margin-right: 10px; 26 padding-left: 10px; 27 padding-right: 10px; 28 width: 80px; 29 } 30 #d3 31 { 32 background-color: blue; 33 height: 30px; 34 position: absolute; 35 top: 82px; 36 width: 150px; 37 } 38 </style> 39 </head> 40 <body> 41 <p>Test passes if the orange and blue rectangles have the <strong>same width</strong>.</p> 42 <div id="div1"> 43 <div></div> 44 </div> 45 <div id="d3"></div> 46 </body> 47 </html>