top-offset-003

Position 'top' property defines the offset from the top edge of the containing block

WeasyPrint

This browser

Assertion
The 'top' property, for absolute positioning, specifies the offset of the element in relation to the containing block's top padding edge.

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: Position 'top' property defines the offset from the top edge of the containing block</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-top">
 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="The 'top' property, for absolute positioning, specifies the offset of the element in relation to the containing block's top padding edge.">
10         <style type="text/css">
11             #container
12             {
13                 height: 1in;
14                 padding-top: 0.25in;
15                 position: relative;
16                 width: 1in;
17             }
18             #div1
19             {
20                 background: white;
21                 height: 0.5in;
22                 position: absolute;
23                 top: 0.75in;
24                 width: 0.5in;
25             }
26             #div2
27             {
28                 background: blue;
29                 height: 1in;
30                 width: 1in;
31             }
32         </style>
33     </head>
34     <body>
35         <p>Test passes if there is a box below with its bottom-left corner missing.</p>
36         <div id="container">
37             <div id="div1"></div>
38             <div id="div2"></div>
39         </div>
40     </body>
41 </html>