margin-collapse-024.xht (1718B)
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 - in-flow block-level margin adjoining child's margin</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 <link rel="match" href="margin-collapse-024-ref.xht" /> 8 9 <meta name="flags" content="ahem image" /> 10 <meta name="assert" content="When an in-flow block-level element (#div3) is adjoining its in-flow block-level child's top margin and the child has no top border, no top padding or no clearance applied to it, then such top margins collapse." /> 11 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 12 <style type="text/css"> 13 div 14 { 15 font: 20px/1em Ahem; 16 width: 5em; 17 } 18 #div1 19 { 20 background: url('support/margin-collapse-2em-space.png'); 21 height: 4em; 22 } 23 #div2, #div4 24 { 25 background: green; 26 height: 1em; 27 } 28 #div3 29 { 30 background: red; 31 } 32 #div3, #div4 33 { 34 margin-top: 2em; 35 } 36 </style> 37 </head> 38 <body> 39 <p>Test passes if there is no red.</p> 40 <div id="div1"> 41 <div id="div2"></div> 42 <div id="div3"> 43 <div id="div4"></div> 44 </div> 45 </div> 46 </body> 47 </html>