relpos-calcs-007

Relative Positioning - overconstrained top = -bottom

WeasyPrint

This browser

Assertion
For a relatively positioned element, if neither 'top' nor 'bottom' is 'auto', used value of 'bottom' is minus the value of 'top'.

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 - overconstrained top = -bottom</title>
 5     <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
 6     <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#relative-positioning">
 7     <meta name="flags" content="">
 8     <meta name="assert" content="For a relatively positioned element, if       neither 'top' nor 'bottom' is 'auto', used value of 'bottom' is minus the       value of 'top'.">
 9     <style type="text/css">
10         div {
11             height: 80px;
12             width: 120px;
13         }
14         .outer {
15             background: green;
16             position: relative;
17             top: 50%;
18             bottom: 50%;
19         }
20         .inner {
21             background: green;
22             position: relative;
23             bottom: inherit; /* using inheritance to test computed vs. used */
24         }
25         .control {
26           background: red;
27           margin-top: -80px;
28           height: 120px;
29         }
30     </style>
31   </head>
32   <body>
33     <p>There must be a green box below and no red.</p>
34     <div class="container">
35       <div class="outer">
36         <div class="inner"></div>
37       </div>
38     </div>
39     <div class="control"></div>
40   </body>
41 </html>