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 - position of top border edge for elements that collapse margins with parents whose bottom margin only participates in margin 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="">
8 <meta name="assert" content="When margins collapse through empty elements and only the parent element's bottom margin is participating in margin collapsing then the position of the elements top border should be in the same position as if the element had a top border specified.">
9 <style type="text/css">
10 div
11 {
12 width: 5em;
13 }
14 #div1
15 {
16 border-top: 1em solid black;
17 }
18 #div2
19 {
20 margin-top: 2em;
21 margin-bottom: 4em;
22 border-top: 1em solid black;
23 }
24 #div3
25 {
26 height: 0;
27 margin-top: 2em;
28 margin-bottom: 2em;
29 }
30 #div4
31 {
32 margin-top: 2em;
33 margin-bottom: 2em;
34 border-top: 1em solid black;
35 }
36 </style>
37 </head>
38 <body>
39 <p>Test passes if there are three evenly-spaced black boxes stacked on the page.</p>
40 <div id="div1">
41 <div id="div2">
42 <div id="div3"></div>
43 <div id="div4"></div>
44 </div>
45 </div>
46 </body>
47 </html>