margin-collapse-029.xht (1803B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Margin collapsing - position of top border edge for elements that collapse margins with parents not participating 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="assert" content="When margins collapse through empty elements and the parent element is not 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." /> 8 <style type="text/css"> 9 div 10 { 11 width: 5em; 12 } 13 #div1 14 { 15 border-top: 1em solid black; 16 } 17 #div2 18 { 19 margin-top: 2em; 20 margin-bottom: 4em; 21 position: absolute; 22 background: black; 23 height: 1em; 24 } 25 #div3 26 { 27 height: 0; 28 margin-top: 2em; 29 margin-bottom: 2em; 30 } 31 #div4 32 { 33 margin-top: 3em; 34 margin-bottom: 2em; 35 border-top: 1em solid black; 36 } 37 </style> 38 </head> 39 <body> 40 <p>Test passes if there are three evenly-spaced black boxes stacked on the page.</p> 41 <div id="div1"> 42 <div id="div2"> 43 <div id="div3"></div> 44 <div id="div4"></div> 45 </div> 46 </div> 47 </body> 48 </html>