inline-formatting-context-010b.xht (3650B)
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: line-height - line box height calculations</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#line-height" title="10.8 Line height calculations: the 'line-height' and 'vertical-align' properties" /> 11 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#inline-formatting" title="9.4.2 Inline formatting contexts" /> 12 13 <meta content="text/javascript" http-equiv="Content-Script-Type" /> 14 <meta content="ahem dom image interact" name="flags" /> 15 <meta content="A line box is always tall enough for all of the boxes it contains. A line box can be as tall as the tallest inline non-replaced box it contains." name="assert" /> 16 17 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 18 <style type="text/css"><![CDATA[ 19 body 20 { 21 background: white url("support/ruler-v-100px-200px.png") no-repeat; 22 margin: 8px 8px 8px 55px; 23 /* 24 25 16px : margin collapsing between body's margin-top and p's margin-top == max(8px, 16px) 26 + 27 20px : first line of p 28 + 29 20px : second line box of p 30 + 31 20px : third line box of p 32 + 33 24px : margin-bottom of p 34 ======= 35 100px 36 37 */ 38 } 39 40 p 41 { 42 font: 1em/1.25 serif; 43 margin: 1em 0.5em 1.5em; 44 } 45 46 div 47 { 48 background-color: orange; /* The line box will be painted orange */ 49 font-family: Ahem; 50 line-height: 0; 51 } 52 53 span 54 { 55 color: black; 56 line-height: 1; 57 vertical-align: baseline; 58 } 59 60 span#twenty {font-size: 20px; display: none;} 61 62 span#thirty {font-size: 30px; display: none;} 63 64 span#forty {font-size: 40px; display: none;} 65 66 span#fifty {font-size: 50px; display: none;} 67 68 span#sixty {font-size: 60px; display: none;} 69 70 span#eighty {font-size: 80px; display: none;} 71 72 span#one-hundred {font-size: 100px; display: none;} 73 ]]></style> 74 75 <script type="text/javascript"><![CDATA[ 76 function resetChkboxes() 77 { 78 var collectionOfCheckboxes = document.getElementsByTagName("input"); 79 for (var iterator = 0; iterator < collectionOfCheckboxes.length; iterator++) 80 { 81 collectionOfCheckboxes.item(iterator).checked = false; 82 }; 83 } 84 85 function updateLinebox(chkbox) 86 { 87 if(chkbox.checked) 88 { 89 document.getElementById(chkbox.id.slice(3)).style.display = "inline"; 90 } 91 else 92 { 93 document.getElementById(chkbox.id.slice(3)).style.display = "none"; 94 }; 95 } 96 ]]></script> 97 98 </head> 99 100 <body onload="resetChkboxes();"> 101 102 <p>Check or uncheck as many checkboxes as you want.<br /> 103 Test passes if the orange rectangle is always just<br /> 104 tall enough to contain the tallest black square in it.</p> 105 106 <div><span id="twenty">2</span> <span id="thirty">3</span> <span id="forty">4</span> <span id="fifty">5</span> <span id="sixty">6</span> <span id="eighty">8</span> <span id="one-hundred">1</span></div> 107 108 <p><input type="checkbox" id="chktwenty" value="20" onclick="updateLinebox(this);" /><input type="checkbox" id="chkthirty" value="30" onclick="updateLinebox(this);" /><input type="checkbox" id="chkforty" value="40" onclick="updateLinebox(this);" /><input type="checkbox" id="chkfifty" value="50" onclick="updateLinebox(this);" /><input type="checkbox" id="chksixty" value="60" onclick="updateLinebox(this);" /><input type="checkbox" id="chkeighty" value="80" onclick="updateLinebox(this);" /><input type="checkbox" id="chkone-hundred" value="100" onclick="updateLinebox(this);" /></p> 109 110 </body> 111 </html>