1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
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="help" href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">
7 <meta name="flags" content="">
8 <meta name="assert" content="If the element has 'position: absolute', the containing block is established by the nearest positioned ancestor.">
9 <style type="text/css">
10 #div1
11 {
12 border: solid black;
13 margin: 50px;
14 position: fixed;
15 top: 0;
16 }
17 div div
18 {
19 height: 1in;
20 width: 1in;
21 }
22 #div2
23 {
24 margin: 50px;
25 }
26 #div3
27 {
28 background: blue;
29 right: 0;
30 position: absolute;
31 top: 0;
32 }
33 </style>
34 </head>
35 <body>
36 <p>Test passes if the blue box is in the upper-right corner of the black box.</p>
37 <div id="div1">
38 <div id="div2">
39 <div id="div3"></div>
40 </div>
41 </div>
42 </body>
43 </html>