vertical-align-baseline-005a.xht (2307B)
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: Vertical-align applied to an 'inline-block' with 'overflow' not set to 'visible' and baseline alignment</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#leading" title="10.8.1 Leading and half-leading" /> 11 <link rel="match" href="vertical-align-baseline-004a-ref.xht" /> 12 13 <meta content="ahem image" name="flags" /> 14 <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" /> 15 16 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 17 <style type="text/css"><![CDATA[ 18 body {margin: 8px;} 19 20 p 21 { 22 font: 1em/1.25 serif; 23 margin: 1em 0em; 24 } 25 26 div#wrapper 27 { 28 background-color: yellow; 29 /* 30 The sole purpose for such yellow background 31 is to help delimit and visually identify the 32 content area of the block container box. 33 */ 34 35 color: black; 36 font: 50px/1 Ahem; 37 /* 38 So that 50px / 5 == 10 without remainder; 39 that way, the accurate position of baseline 40 does not imply fractional pixel. 41 Also, the height of the "p" glyph will not 42 create fractional pixel either. 43 */ 44 } 45 46 div#inline-block-with-overflow-hidden 47 { 48 color: blue; 49 display: inline-block; 50 margin-bottom: 99px; 51 height: 2em; 52 overflow: hidden; 53 width: 2em; 54 } 55 56 img 57 { 58 position: absolute; 59 top: 72px; 60 61 /* 62 63 16px : max(body's margin-top, p's margin-top) == max(8px, 16px) 64 + 65 20px : p's first line box height 66 + 67 20px : p's second line box height 68 + 69 16px : p's margin-bottom 70 ======== 71 72px 72 73 */ 74 } 75 ]]></style> 76 77 </head> 78 79 <body> 80 81 <p>Test passes if the bottom edge of the blue square is flush with the 100px<br /> 82 line and if the top edge of the black stripe is flush with the 200px line.</p> 83 84 <div id="wrapper"> 85 <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 86 </div> 87 88 </body> 89 </html>