vertical-align-118a.xht (1851B)
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: text-top' - line-height</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="Section 10.8.1 Leading and half-leading" /> 11 <link rel="match" href="vertical-align-118a-ref.xht" /> 12 13 <meta content="ahem" name="flags" /> 14 <meta content="For inline non-replaced elements (such as the span element in this testcase), the box used for vertical-alignment is the box whose height is the 'line-height' (containing the box's glyphs and the half-leading on each side). 'vertical-align: text-top' will align the top of such box with the top of the parent's content area and not with the bottom of the parent's box." name="assert" /> 15 16 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 17 <style type="text/css"><![CDATA[ 18 div 19 { 20 background-color: yellow; 21 /* 22 The sole purpose for such yellow background 23 is to help delimit and visually identify the 24 content area of the block container box. 25 */ 26 font: 2.5em/3.25 Ahem; 27 /* 28 equivalent to font: 40px/130px (with top-half-leading 29 and bottom-half-leading each equal to 45px) but 30 entirely font-size-relative and perfectly 31 text-size-scalable in all browsers 32 */ 33 } 34 35 span 36 { 37 color: blue; 38 margin: auto -1em; 39 vertical-align: text-top; 40 } 41 ]]></style> 42 43 </head> 44 45 <body> 46 47 <p>Test passes if the blue stripe is vertically offset <strong>below the black stripes on both sides</strong>. The blue stripe must be clearly and entirely below the black stripes.</p> 48 49 <div>LLLL<span>MustBeBelow</span>LLLL</div> 50 51 </body> 52 </html>