inline-block-non-replaced-height-002.xht (1987B)
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: Inline-block non-replaced elements' margin box is used for the height of the line box</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-10-12 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#block-root-margin" /> 8 <link rel="match" href="height-percentage-001-ref.xht" /> 9 10 <meta name="assert" content="Inline-block non-replaced elements use the margin box for sizing the height of the line box." /> 11 <style type="text/css"> 12 #div1 13 { 14 line-height: 0; 15 position: relative; 16 } 17 #div2 18 { 19 background: blue; 20 } 21 22 /* 23 The test relies and assumes that div#div2's 24 computed height will be and should be 25 equal to the its used line box height since it has 26 only 1 inline-level element which is contributing to 27 determine its line box height. 28 */ 29 30 #div2 div 31 { 32 display: inline-block; 33 height: 0; 34 margin: 0.5in 0; 35 } 36 div div 37 { 38 width: 1in; 39 } 40 #div3 41 { 42 background: orange; 43 left: 1in; 44 height: 1in; 45 position: absolute; 46 top: 0; 47 } 48 </style> 49 </head> 50 <body> 51 <p>Test passes if the blue and orange squares have the <strong>same height</strong>.</p> 52 <div id="div1"> 53 <div id="div2"> 54 <div></div> 55 </div> 56 <div id="div3"></div> 57 </div> 58 </body> 59 </html>