<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CSS Test: Inline-block non-replaced elements' margin box is used for the height of the line box</title> <style type="text/css"> @page { font: italic 8pt sans-serif; color: gray; margin: 7%; counter-increment: page; @top-left { content: "CSS 2.1 Conformance Test Suite"; } @top-right { content: "Test inline-block-non-replaced-height-002"; } @bottom-right { content: counter(page); } } </style> <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-10-12 --> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#block-root-margin" /> <link rel="match" href="reference/height-percentage-001-ref.xht" /> <meta name="flags" content="" /> <meta name="assert" content="Inline-block non-replaced elements use the margin box for sizing the height of the line box." /> <style type="text/css"> #div1 { line-height: 0; position: relative; } #div2 { background: blue; } /* The test relies and assumes that div#div2's computed height will be and should be equal to the its used line box height since it has only 1 inline-level element which is contributing to determine its line box height. */ #div2 div { display: inline-block; height: 0; margin: 0.5in 0; } div div { width: 1in; } #div3 { background: orange; left: 1in; height: 1in; position: absolute; top: 0; } </style> </head> <body> <p>Test passes if the blue and orange squares have the <strong>same height</strong>.</p> <div id="div1"> <div id="div2"> <div></div> </div> <div id="div3"></div> </div> </body> </html>