margin-collapse-154

Margin Collapsing: effect of margins near float on collapsing-through

WeasyPrint

This browser

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html lang="en">
 3 <head>
 4   <title>CSS Test: Margin Collapsing: effect of margins near float on collapsing-through</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/054.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 { border: solid; width: 4em; background: red; padding: 0; font: 2em/1 Ahem; }
10    .bg { background: orange; color: navy; }
11    .a { margin: 0 0 1em 0; background: yellow; }
12    .c { margin: 1em 0 0 0; background: aqua; }
13    span { float: right; background: lime; padding-right: 1em; }
14    .b1 { margin: 1em 0 1em 0; }
15    .b2 { margin: 0em 0 1em 0; }
16    .b3 { margin: 1em 0 0em 0; }
17    .b4 { margin: 0em 0 0em 0; }
18    .b5 { margin: 0.5em 0 0.5em 0; }
19    .b6 { margin: 0em 0 0.5em 0; }
20    .b7 { margin: 0.5em 0 0em 0; }
21    .control .a { margin: 0 0 1em 0; }
22    .control .b { height: 0; text-align: right; }
23    .control span { float: none; }
24    .control .c { margin: 0; }
25   </style>
26  </head>
27  <body>
28   <p>All the following should look the same (and all should look like
29   the first).</p>
30   <table>
31    <tr>
32     <td class="control">
33      <div class="bg">
34       <div class="a">A</div>
35       <div class="b"><span>B</span></div>
36       <div class="c">C</div>
37      </div>
38     </td>
39     <td>
40      <div class="bg">
41       <div class="a">A</div>
42       <div class="b1"><span>B</span></div>
43       <div class="c">C</div>
44      </div>
45     </td>
46     <td>
47      <div class="bg">
48       <div class="a">A</div>
49       <div class="b2"><span>B</span></div>
50       <div class="c">C</div>
51      </div>
52     </td>
53     <td>
54      <div class="bg">
55       <div class="a">A</div>
56       <div class="b3"><span>B</span></div>
57       <div class="c">C</div>
58      </div>
59     </td>
60     <td>
61      <div class="bg">
62       <div class="a">A</div>
63       <div class="b4"><span>B</span></div>
64       <div class="c">C</div>
65      </div>
66     </td>
67     <td>
68      <div class="bg">
69       <div class="a">A</div>
70       <div class="b5"><span>B</span></div>
71       <div class="c">C</div>
72      </div>
73     </td>
74     <td>
75      <div class="bg">
76       <div class="a">A</div>
77       <div class="b6"><span>B</span></div>
78       <div class="c">C</div>
79      </div>
80     </td>
81     <td>
82      <div class="bg">
83       <div class="a">A</div>
84       <div class="b7"><span>B</span></div>
85       <div class="c">C</div>
86      </div>
87     </td>
88    </tr>
89   </table>
90   <p>This test is meaningless if you don't pass <a href="margin-collapse-155">test 055</a>.</p>
91  
92 
93 </body>
94 </html>