relpos-calcs-004

Relative Positioning - auto right = -left

WeasyPrint

This browser

Assertion
For a relatively positioned element, if 'right' is 'auto', its used value is minus the value of 'left'.

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 - auto right = -left</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 'right'       is 'auto', its used value is minus the value of 'left'.">
 9     <style type="text/css">
10         div {
11             height: 120px;
12             width: 120px;
13             margin-right: auto;
14             direction: ltr;
15         }
16         .container {
17             margin-left: -60px;
18             direction: rtl; /* only set RTL on the containing block in question */
19         }
20         .outer {
21             background: red;
22             position: relative;
23             left: 50%;
24         }
25         .inner {
26             background: green;
27             position: relative;
28             right: inherit; /* using inheritance to test computed vs. used */
29         }
30         .control {
31           background: red;
32           margin-bottom: -120px;
33         }
34     </style>
35   </head>
36   <body>
37     <p>There must be a green box below and no red.</p>
38     <div class="control"></div>
39     <div class="container" dir="rtl">
40       <div class="outer" dir="ltr">
41         <div class="inner"></div>
42       </div>
43     </div>
44   </body>
45 </html>