margin-collapse-031

margin collapsing

WeasyPrint

This browser

Assertion
The top margin of an in-flow block-level element is adjoining to its first in-flow block-level child's top margin if the element has no top border, no top padding, and the child has no clearance.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3 
 4  <head>
 5 
 6   <title>CSS Test: margin collapsing</title>
 7 
 8   <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
 9   <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
10   <meta name="flags" content="">
11   <meta name="assert" content="The top margin of an in-flow block-level element is adjoining to its first in-flow block-level child's top margin if the element has no top border, no top padding, and the child has no clearance.">
12 
13   <style type="text/css">
14   body
15   {
16   background-color: white;
17   margin: 8px;
18   }
19   
20   div#parent-block-container
21   {
22   background-color: red;
23   margin: 0px;
24   width: 100%;
25   }
26 
27   div#child-block
28   {
29   background-color: lime;
30   margin: 100px 0px;
31   }
32   </style>
33 
34  </head>
35 
36  <body>
37 
38   <div id="parent-block-container">
39    <div id="child-block">
40     There should be no red in this page
41    </div>
42   </div>
43 
44  </body>
45 </html>