vertical-align-baseline-004a.xht (2524B)
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 empty 'inline-block' 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' that has no in-flow line boxes is at its bottom margin edge. The bottom margin edge of an 'inline-block' that has no inflow line boxes will 'sit' on the baseline, will be located on the baseline of such 'inline-block'." 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-without-inflow-line-boxes 47 { 48 background-color: blue; 49 display: inline-block; 50 margin-bottom: 99px; 51 height: 2em; 52 width: 2em; 53 } 54 55 img 56 { 57 position: absolute; 58 top: 72px; 59 60 /* 61 62 16px : max(body's margin-top, p's margin-top) == max(8px, 16px) 63 + 64 20px : p's first line box height 65 + 66 20px : p's second line box height 67 + 68 16px : p's margin-bottom 69 ======== 70 72px 71 72 */ 73 } 74 ]]></style> 75 76 </head> 77 78 <body> 79 80 <p>Test passes if the bottom edge of the blue square is flush with the 100px<br /> 81 line and if the top edge of the black stripe is flush with the 200px line.</p> 82 83 <div id="wrapper"><div id="inline-block-without-inflow-line-boxes"></div><img src="support/ruler-v-100px-200px.png" width="55" height="250" alt="Image download support must be enabled" />pppppppp</div> 84 85 <!-- 86 By definition, the top of "p" glyphs - which is the 87 black stripe in the rendered layout - should be 88 perfectly flush with the baseline. 89 --> 90 91 </body> 92 </html>