<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

 <head>

  <title>CSS Test: margin collapsing - clear with child margin</title>

  <!--
  Inspired by
  http://test.csswg.org/suites/css2.1/20110323/html4/c5525-fltmult-000.htm
  -->

  <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
  <link rel="reviewer" title="Arron Eicholz" href="arronei(at)gmail.com"> <!-- 2013-07-30 -->
  <link rel="bookmark" href="http://lists.w3.org/Archives/Public/public-css-testsuite/2012Jan/0022.html" title="[RC6] c5525-fltmult-000 imprecise and failed by several browsers">
  <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" title="8.3.1 Collapsing margins">
  <link rel="match" href="reference/ref-filled-green-100px-square.htm">

  <meta name="flags" content="">
  <meta name="assert" content="An element on which 'clear' is set to a value other than 'none' can have its own margin-top collapse with its first inflow block-level child as long as no line boxes, no clearance, no padding and no border separate them.">

  <style type="text/css">
  body {margin: 8px;}

  p {margin: 1em 0em;}

  div#overlapped-red
  {
  background-color: red;
  height: 100px;
  position: absolute;
  width: 100px;
  z-index: -1;
  }

  div#floated-left
  {
  background-color: green;
  color: green;
  float: left;
  font: 1em/1.25 serif;
  padding: 15px;
  /*

    15px : padding-top
  +
    20px : line box height
  +
    15px : padding-bottom
   =====
    50px

  */
  width: 70px;
  }

  div#cleared-left {clear: left;}

  table
  {
  border-collapse: separate;
  border-spacing: 0px;
  margin-top: 50px;
  }

  td
  {
  background-color: green;
  color: green;
  height: 50px;
  padding: 0px;
  width: 100px;
  }

  /*
  The idea is to have div#cleared-left's margin-top collapse
  with the table's margin-top. The margin collapsing
  should occur before calculating clearance.
  */
  </style>

 </head>

 <body>

  <p>Test passes if there is a filled green square and <strong>no red</strong>.</p>

  <div id="overlapped-red"></div>

  <div id="floated-left">flt lef</div>

  <div id="cleared-left">
   <table>
    <tr>
     <td>td</td>
    </tr>
   </table>
  </div>

 </body>
</html>