containing-block-021.xht (2094B)
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: Containing Blocks - Block-level elements position based on left-to-right direction and parent element is fixed</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-07-01 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details" /> 8 <link rel="match" href="containing-block-019-ref.xht" /> 9 10 <meta name="assert" content="When the nearest (closest within document containment hierarchy) positioned ancestor of an absolutely positioned element is a block-level element, then the containing block of such absolutely positioned element is formed by the padding edge of such nearest positioned ancestor." /> 11 <style type="text/css"> 12 div 13 { 14 border: solid black; 15 padding: 1in; 16 position: fixed; 17 width: 0; 18 } 19 span 20 { 21 display: block; 22 } 23 #span1 24 { 25 direction: ltr; 26 } 27 28 /* 29 The span#span1 element determines, conditions (§10.3.7 and 30 §10.6.4) the 'top: auto' and 'left: auto' coordinates while the 31 wrapping div's padding box forms the containing block 32 geometry/area. 33 */ 34 35 span span 36 { 37 background: blue; 38 height: 1in; 39 left: auto; 40 position: absolute; 41 top: auto; 42 width: 1in; 43 } 44 </style> 45 </head> 46 <body> 47 <p>Test passes if a filled blue square is in the <strong>lower-right corner</strong> of an hollow black square.</p> 48 <div> 49 <span id="span1"> 50 <span></span> 51 </span> 52 </div> 53 </body> 54 </html>