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: Margin collapsing - elements that collapse margins have to effect on positions of other elements that also have margins that are collapsing</title>
5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
6 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins">
7 <meta name="flags" content="ahem image">
8 <meta name="assert" content="Positions of elements that have been collapsed through (empty elements) have no effect on positions of other elements whose margins are being collapsed.">
9 <style type="text/css">
10 div
11 {
12 font: 20px/1em Ahem;
13 width: 5em;
14 }
15 div div
16 {
17 height: 1em;
18 }
19 #div1
20 {
21 background: url('support/margin-collapse-2em-space.png') left -1em;
22 border-top: 1em solid green;
23 }
24 #div2
25 {
26 background: red;
27 }
28 #div3
29 {
30 background: red;
31 height: 0;
32 margin-top: 2em;
33 margin-bottom: 2em;
34 }
35 #div4
36 {
37 background: green;
38 margin-top: 2em;
39 }
40 </style>
41 </head>
42 <body>
43 <p>Test passes if there is no red visible on the page.</p>
44 <div id="div1">
45 <div id="div2">
46 <div id="div3"></div>
47 <div id="div4"></div>
48 </div>
49 </div>
50 </body>
51 </html>