containing-block-010.xht (1684B)
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 block for absolute positioned elements is nearest positioned (fixed) ancestor</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-03-07 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details" /> 8 <link rel="match" href="containing-block-008-ref.xht" /> 9 10 <meta name="assert" content="If the element has 'position: absolute', the containing block is established by the nearest positioned ancestor." /> 11 <style type="text/css"> 12 #div1 13 { 14 border: solid black; 15 margin: 50px; 16 position: fixed; 17 top: 0; 18 } 19 div div 20 { 21 height: 1in; 22 width: 1in; 23 } 24 #div2 25 { 26 margin: 50px; 27 } 28 #div3 29 { 30 background: blue; 31 right: 0; 32 position: absolute; 33 top: 0; 34 } 35 </style> 36 </head> 37 <body> 38 <p>Test passes if a filled blue square is in the <strong>upper-right corner</strong> of an hollow black square.</p> 39 <div id="div1"> 40 <div id="div2"> 41 <div id="div3"></div> 42 </div> 43 </div> 44 </body> 45 </html>