<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>CSS Test: Vertical-align applied to an 'inline-block' with 'overflow' not set to 'visible' and baseline alignment</title> <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/"> <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#leading" title="10.8.1 Leading and half-leading"> <link rel="match" href="reference/vertical-align-baseline-004a-ref.htm"> <meta content="ahem image" name="flags"> <meta content="The baseline of an 'inline-block' whose 'overflow' property has a computed value other than 'visible' is located at its bottom margin edge." name="assert"> <style type="text/css"> body {margin: 8px;} p { font: 1em/1.25 serif; margin: 1em 0em; } div#wrapper { background-color: yellow; /* The sole purpose for such yellow background is to help delimit and visually identify the content area of the block container box. */ color: black; font: 50px/1 Ahem; /* So that 50px / 5 == 10 without remainder; that way, the accurate position of baseline does not imply fractional pixel. Also, the height of the "p" glyph will not create fractional pixel either. */ } div#inline-block-with-overflow-hidden { color: blue; display: inline-block; margin-bottom: 99px; height: 2em; overflow: hidden; width: 2em; } img { position: absolute; top: 72px; /* 16px : max(body's margin-top, p's margin-top) == max(8px, 16px) + 20px : p's first line box height + 20px : p's second line box height + 16px : p's margin-bottom ======== 72px */ } </style> </head> <body> <p>Test passes if the bottom edge of the blue square is flush with the 100px<br> line and if the top edge of the black stripe is flush with the 200px line.</p> <div id="wrapper"> <div id="inline-block-with-overflow-hidden">XXX XXX XXX</div><img src="support/ruler-v-100px-200px.png" width="55" height="250" alt="Image download support must be enabled">pppppppp </div> </body> </html>