margin-collapse-166

Margins on cleared blocks that contain floats, with dynamic border changes

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: Margins on cleared blocks that contain floats, with dynamic border changes</title>
 5   <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
 6   <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/066.html" type="text/html">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
 8   <style type="text/css">
 9    td { padding: 0; background: red; }
10    .border { width: 7em; /* border: solid; added by script at bottom of test */ }
11    .box { margin: 0; background: yellow; }
12    .float { margin: 0; width: 4em; height: 1.5em; background: aqua; float: right; }
13    .clear { margin: 2em 0 0 0; background: orange; clear: both; }
14    .control { border: solid; width: 7em; background: yellow; }
15    .control .a { margin: 0 0 0 auto; width: 4em; height: 1.5em; background: aqua; }
16    .control .b { height: 0.5em; }
17    .control .c { background: orange; }
18   </style>
19  </head>
20  <body>
21   <p>The following four boxes should be identical, with no red present.</p>
22   <table>
23    <tr>
24     <td>
25      <div class="outer">
26       <div id="test" class="box border">
27        <div class="float">TEST</div>
28        <div class="clear">TEST</div>
29       </div>
30      </div>
31     </td>
32     <td>
33      <div class="control">
34       <div class="a">TEST</div>
35       <div class="b"></div>
36       <div class="c">TEST</div>
37      </div>
38     </td>
39    </tr>
40    <tr>
41     <td>
42      <div class="control">
43       <div class="a">TEST</div>
44       <div class="b"></div>
45       <div class="c">TEST</div>
46      </div>
47     </td>
48     <td>
49      <div class="control">
50       <div class="a">TEST</div>
51       <div class="b"></div>
52       <div class="c">TEST</div>
53      </div>
54     </td>
55    </tr>
56   </table>
57   <script type="text/javascript">
58    var x = document.getElementById('test');
59    x.clientHeight; // force reflow
60    x.style.border = "solid"; // did reflow happen?
61   </script>
62  
63 </body>
64 </html>