relpos-calcs-006

Relative Positioning - overconstrained left = -right (RTL)

WeasyPrint

This browser

Assertion
For a relatively positioned element in an RTL containing block, if neither 'left' nor 'right' is 'auto', used value of 'left' is minus the value of 'right'.

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