anonymous-boxes-001a.xht (2231B)
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: Percent height inside anonymous block</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/visuren.html#anonymous-block-level" /> 11 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details" /> 12 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#the-height-property" /> 13 <link rel="match" href="anonymous-boxes-001a-ref.xht" /> 14 15 <meta content="ahem image" name="flags" /> 16 <meta content="Anonymous block boxes are ignored when resolving percentage values that would refer to it: the closest non-anonymous ancestor box is used instead." name="assert" /> 17 18 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 19 <style type="text/css"><![CDATA[ 20 body {margin: 8px;} 21 22 div#overlapped-red 23 { 24 background-color: red; 25 height: 100px; 26 left: 208px; 27 /* 28 8px : body's margin-left 29 + 30 160px : 4 characters of "Some" 40px wide each 31 + 32 40px : one blank white space of 40px wide 33 -------------------------------------------------- 34 208px 35 */ 36 position: absolute; 37 width: 100px; 38 z-index: -1; 39 } 40 41 div#closest-non-anonymous-ancestor 42 { 43 color: white; 44 font: 2.5em/1.25 Ahem; /* equivalent to 40px/50px in absolute units */ 45 height: 200px; 46 } 47 48 img#child-of-anonymous-block-box {height: 50%;} 49 ]]></style> 50 51 </head> 52 53 <body> 54 55 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 56 57 <div id="overlapped-red"></div> 58 59 <div id="closest-non-anonymous-ancestor">Some <img id="child-of-anonymous-block-box" src="support/1x1-green.png" alt="Image download support must be enabled" /> text 60 <p>More text</p> 61 </div> 62 63 <!-- 64 For example, if the child of the anonymous block box inside the DIV 65 above needs to know the height of its containing block to resolve a 66 percentage height, then it will use the height of the containing 67 block formed by the DIV, not of the anonymous block box. 68 --> 69 70 </body> 71 </html>