abspos-containing-block-005

Containing block for absolute positioning

WeasyPrint

This browser

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: Containing block for absolute positioning</title>
 5     <link rel="author" title="Bert Bos" href="http://www.w3.org/People/Bos/">
 6     <link rel="reviewer" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact">
 7     <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#containing-block-details">
 8     <style type="text/css">
 9       html { margin: 0; padding: 0; width: 100%; height: 100%; position: relative; }
10       body { background: red; margin: 100px 20%; }
11       div { background: white; color: green; position: absolute; top: 0; right: 0; width: 100%; height: 100%; }
12     </style>
13   </head>
14   <body>
15     <div>
16       There should be no red on this page.
17     </div>
18   </body>
19 </html>