line-height-127.xht (1706B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: line-height of images</title> 5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 6 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/fonts/line-height/007.html" type="text/html"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#line-height" /> 8 <link rel="match" href="line-height-127-ref.xht" /> 9 10 <meta content="ahem image" name="flags" /> 11 12 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 13 <style type="text/css"> 14 table { font: 10em/1 Ahem; border-spacing: 0; } 15 td { padding: 0; background: red; } 16 img { width: 1em; height: 1px; } 17 .test { line-height: 0; background: green; } 18 .control { height: 0.3em; background: green; width: 1em; } 19 </style> 20 </head> 21 <body> 22 23 <!-- 24 ! The 0.3em comes from the following: 25 ! 26 ! * The font is 1em high 27 ! * The line height is 0 28 ! * The half leading is therefore -0.5em centered around the middle of the font 29 ! * The baseline is 0.2em from the bottom of the font 30 ! * Thus the distance from the baseline to the center is 0.3em 31 ! * The image is placed on the baseline 32 | * The line box has to include the image and the middle of the font 33 ! * Thus the line box is 0.3em high 34 ! 35 !--> 36 37 <p>Test passes if there is <strong>no red</strong>.</p> 38 <table> 39 <tr> 40 <td><div class="test"><img src="support/1x1-white.png" alt="FAIL (images required)"/></div></td> 41 <td><div class="control"></div></td> 42 </tr> 43 </table> 44 </body> 45 </html>