margin-collapse-clear-015

Margin collapsing with clearance - Margins collapsing of an element's top margin with its first in-flow child should not be affected by clear and clearance

WeasyPrint

This browser

Assertion
When an element with clear set to it (to other than 'none') has a first in-flow child and their top margins are adjoining, then these margins should collapse normally.

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 with clearance - Margins collapsing of an element's top margin with its first in-flow child should not be affected by clear and clearance</title>
  7 
  8   <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
  9   <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
 10   <link rel="author" title="Bruno Fassino" href="fassino[at]gmail.com">
 11   <meta content="When an element with clear set to it (to other than 'none') has a first in-flow child and their top margins are adjoining, then these margins should collapse normally." name="assert">
 12   <meta content="" name="flags">
 13 
 14   <style type="text/css">
 15   #relatively-positioned-wrapper
 16   {
 17   position: relative;
 18   }
 19 
 20   #parent-lime
 21   {
 22   background-color: lime;
 23   border-top: black solid 1px;
 24   width: 50%;
 25   }
 26 
 27   #float-left-blue
 28   {
 29   background-color: blue;
 30   float: left;
 31   height: 100px;
 32   width: 100px;
 33   }
 34 
 35   #clear-left
 36   {
 37   clear: left;
 38   }
 39 
 40   #clear-left div
 41   {
 42   background-color: aqua;
 43   height: 60px;
 44   margin-top: 140px;
 45   }
 46 
 47   #next-yellow
 48   {
 49   background-color: yellow;
 50   height: 100px;
 51   }
 52 
 53   .ref-overlapped-red
 54   {
 55   background-color: red;
 56   left: 0;
 57   position: absolute;
 58   z-index: -1;
 59   }
 60 
 61   #ref1
 62   {
 63   height: 200px;
 64   top: 1px;
 65   width: 50%;
 66   }
 67 
 68   #ref2
 69   {
 70   height: 100px;
 71   top: 201px;
 72   width: 100%;
 73   }
 74   </style>
 75 
 76  </head>
 77 
 78  <body>
 79 
 80   <p>Test passes if there is no red visible on the page.</p>
 81 
 82   <div id="relatively-positioned-wrapper">
 83 
 84    <div id="parent-lime">
 85     <div id="float-left-blue"></div>
 86     <div id="clear-left">
 87      <div></div>
 88     </div>
 89    </div>
 90 
 91    <div id="next-yellow"></div>
 92 
 93    <!--
 94    #ref1 and #ref2 boxes create a sort of 'reference rendering' where #ref1 should be covered, overlapped by #parent-lime while #ref2 should be covered, overlapped by #next-yellow.
 95    -->
 96 
 97    <div id="ref1" class="ref-overlapped-red"></div>
 98    <div id="ref2" class="ref-overlapped-red"></div>
 99 
100   </div>
101 
102  </body>
103 </html>