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 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/055.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; background: red; padding: 0; font: 3em/1 Ahem; }
10 .bg { background: orange; color: yellow; }
11 .a { margin: 0 0 1em 0; background: lime; }
12 .c { margin: 1em 0 0 0; background: aqua; }
13 .b1 { margin: 1em 0 1em 0; }
14 .b2 { margin: 0em 0 1em 0; }
15 .b3 { margin: 1em 0 0em 0; }
16 .b4 { margin: 0em 0 0em 0; }
17 .b5 { margin: 0.5em 0 0.5em 0; }
18 .b6 { margin: 0em 0 0.5em 0; }
19 .b7 { margin: 0.5em 0 0em 0; }
20 .control .a { margin: 0 0 1em 0; }
21 .control .c { margin: 0; }
22 </style>
23 </head>
24 <body>
25 <p>All the following should look the same (and all should look like
26 the first).</p>
27 <table>
28 <tr>
29 <td class="control">
30 <div class="bg">
31 <div class="a">A</div>
32 <div class="c">C</div>
33 </div>
34 </td>
35 <td>
36 <div class="bg">
37 <div class="a">A</div>
38 <div class="b1"></div>
39 <div class="c">C</div>
40 </div>
41 </td>
42 <td>
43 <div class="bg">
44 <div class="a">A</div>
45 <div class="b2"></div>
46 <div class="c">C</div>
47 </div>
48 </td>
49 <td>
50 <div class="bg">
51 <div class="a">A</div>
52 <div class="b3"></div>
53 <div class="c">C</div>
54 </div>
55 </td>
56 <td>
57 <div class="bg">
58 <div class="a">A</div>
59 <div class="b4"></div>
60 <div class="c">C</div>
61 </div>
62 </td>
63 <td>
64 <div class="bg">
65 <div class="a">A</div>
66 <div class="b5"></div>
67 <div class="c">C</div>
68 </div>
69 </td>
70 <td>
71 <div class="bg">
72 <div class="a">A</div>
73 <div class="b6"></div>
74 <div class="c">C</div>
75 </div>
76 </td>
77 <td>
78 <div class="bg">
79 <div class="a">A</div>
80 <div class="b7"></div>
81 <div class="c">C</div>
82 </div>
83 </td>
84 </tr>
85 </table>
86
87
88 </body>
89 </html>