position-absolute-006.xht (1507B)
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: Absolutely positioned elements establishes a new containing block for absolutely positioned children</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#absolute-positioning" /> 7 <link rel="match" href="position-absolute-004-ref.xht" /> 8 9 <meta name="assert" content="An absolutely positioned box establishes a new containing block for absolutely positioned children." /> 10 <style type="text/css"> 11 #div1 12 { 13 height: 2in; 14 position: relative; 15 width: 2in; 16 } 17 div div 18 { 19 height: 1in; 20 width: 1in; 21 } 22 #div2 23 { 24 background: orange; 25 left: 1in; 26 position: absolute; 27 } 28 #div3 29 { 30 background: blue; 31 position: relative; 32 top: 1in; 33 } 34 </style> 35 </head> 36 <body> 37 <p>Test passes if the blue square is directly below the orange square.</p> 38 <div id="div1"> 39 <div id="div2"> 40 <div id="div3"></div> 41 </div> 42 </div> 43 </body> 44 </html>