1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3
4 <head>
5
6 <title>CSS Test: box offsets - containing block for absolute positioned boxes</title>
7
8 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
9 <link rel="help" title="9.3.2 Box offsets: 'top', 'right', 'bottom', 'left'" href="http://www.w3.org/TR/CSS21/visuren.html#position-props">
10 <meta content="image" name="flags">
11 <meta content="Box offsets (bottom, left, right, top) for an absolutely positioned box refers to the padding box of its nearest positioned ancestor; such padding box forms the containing block of the absolutely positioned box." name="assert">
12
13 <style type="text/css">
14 body {margin: 8px;}
15
16 #nearest-positioned-ancestor
17 {
18 background-color: yellow; /* padding box will be yellow */
19 border: orange solid 50px; /* border box will be orange */
20 height: 100px; /* a bright green square 100px by 100px image will serve as content box */
21 margin-left: 100px;
22 padding: 50px;
23 position: relative;
24 top: auto;
25 width: 100px;
26 }
27
28 div > div
29 {
30 background-color: blue;
31 color: white;
32 height: 25px;
33 position: absolute;
34 width: 25px;
35 }
36
37 div#top-left
38 {
39 left: 0px;
40 top: 0px;
41 }
42
43 div#top-right
44 {
45 right: 0px;
46 top: 0px;
47 }
48
49 div#bottom-left
50 {
51 bottom: 0px;
52 left: 0px;
53 }
54
55 div#bottom-right
56 {
57 bottom: 0px;
58 right: 0px;
59 }
60 </style>
61
62 </head>
63
64 <body>
65
66 <p>Test passes if there is a blue square at each corner of the yellow square.</p>
67
68 <div id="nearest-positioned-ancestor"><img src="support/lime_color.png" alt="Image download support must be enabled">
69 <div id="top-left">TL</div>
70 <div id="top-right">TR</div>
71 <div id="bottom-left">BL</div>
72 <div id="bottom-right">BR</div>
73 </div>
74
75 </body>
76 </html>