left-offset-percentage-001

Left offset using percentage

WeasyPrint

This browser

Assertion
Percentage offset values for the 'left' 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: Left 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-left">
 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 'left' property are based off the width of the containing block.">
10         <style type="text/css">
11             #div1
12             {
13                 border: solid black;
14                 height: 150px;
15                 padding: 25px;
16                 position: relative;
17                 width: 50px;
18             }
19             div div
20             {
21                 background: blue;
22                 height: 50px;
23                 left: 50%;
24                 position: absolute;
25                 top: 0;
26                 width: 50px;
27             }
28         </style>
29     </head>
30     <body>
31         <p>Test passes if the blue square is in the top-right corner of the black box.</p>
32         <div id="div1">
33             <div></div>
34         </div>
35     </body>
36 </html>