margin-collapse-017.xht (1770B)
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 - parent edge and element edge are the same when margins collapse</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-08-15 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" /> 8 <link rel="match" href="margin-collapse-017-ref.xht" /> 9 10 <meta name="assert" content="When the top margin of a child box collapses with the top margin of its parent, then the margin-top edge of such child box is the same as the parent's and their respective content should be 'sitting' at the parent's border-bottom (in the testcase, the black line) assuming the same height value and the same padding-bottom value for the parent and its child box." /> 11 <style type="text/css"> 12 #div1 13 { 14 border-bottom: black solid 3px; 15 } 16 div div 17 { 18 height: 20px; 19 margin-top: 60px; 20 width: 60px; 21 } 22 #div2 23 { 24 background: red; 25 } 26 #div3 27 { 28 background: blue; 29 } 30 </style> 31 </head> 32 <body> 33 <p>Test passes if the blue stripe is touching the line and there is <strong>no red</strong>.</p> 34 <div id="div1"> 35 <div id="div2"> 36 <div id="div3"></div> 37 </div> 38 </div> 39 </body> 40 </html>