abspos-containing-block-010

Absolute Positioning: Containing Block of Top Level Absolutely Positioned Block

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: Absolute Positioning: Containing Block of Top Level Absolutely Positioned Block</title>
 5   <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
 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; border: 0; padding: 0; background: white; color: yellow; }
10    body { margin: 1em; border: 1em solid red; padding: 1em; background: red; color: yellow; }
11    p { margin: 1em; padding: 1em; }
12    div { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: green; color: white; }
13   </style>
14  </head>
15  <body>
16   <p>FAIL</p>
17   <p>This page should be completely green.</p>
18   <div>There should be no red on this page.</div>
19   <!-- the <div> element should exactly overlap the <html> element,
20   since they have the same dimensions and the same containing block
21   and the same origin. -->
22  </body>
23 </html>