right-offset-percentage-001

Right offset using percentage

WeasyPrint

This browser

Assertion
Percentage offset values for the 'right' property are based off the width of the containing block.

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: Right offset using percentage</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#propdef-right">
 7         <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#position-props">
 8         <meta name="flags" content="">
 9         <meta name="assert" content="Percentage offset values for the 'right' property are based off the width of the containing block.">
10         <style type="text/css">
11             #div1
12             {
13                 border: solid black;
14                 height: 200px;
15                 position: relative;
16                 width: 100px;
17             }
18             div div
19             {
20                 background: blue;
21                 height: 50px;
22                 margin-left: 50px;
23                 position: absolute;
24                 right: 50%;
25                 width: 50px;
26             }
27         </style>
28     </head>
29     <body>
30         <p>Test passes if the blue square is in the top-left corner of the black box.</p>
31         <div id="div1">
32             <div></div>
33         </div>
34     </body>
35 </html>