position-relative-016

Relative positioning and computed top/bottom values

WeasyPrint

This browser

Assertion
Used value of top equals negative bottom when top is auto and bottom is given. (Computed value of top remains auto.)

Source

 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: Relative positioning and computed top/bottom values</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#positioning-scheme">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="Used value of top equals negative bottom when top is auto and bottom is given. (Computed value of top remains auto.)">
 9         <style type="text/css">
10             div
11             {
12                 height: 1in;
13                 width: 1in;
14             }
15             #div0
16             {
17                 border: 1px solid transparent;
18                 height: 0;
19             }
20             #div1
21             {
22                 position: absolute;
23                 background: red;
24                 margin-top: 1in;
25             }
26             #div2
27             {
28                 bottom: -1in;
29                 position: relative;
30                 top: auto;
31             }
32             #div3
33             {
34                 background: green;
35                 position: relative;
36                 top: inherit;
37             }
38         </style>
39     </head>
40     <body>
41         <p>Test passes if there is no red visible on the page.</p>
42         <div id="div0"></div>
43         <div id="div1"></div>
44         <div id="div2">
45             <div id="div3"></div>
46         </div>
47     </body>
48 </html>