margin-collapse-009.xht (1579B)
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 and elements with 'overflow' set to 'hidden'</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-14 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" /> 8 <link rel="match" href="../reference/ref-if-there-is-no-red.xht" /> 9 10 <meta name="flags" content="ahem" /> 11 <meta name="assert" content="Elements with 'overflow' set to 'hidden' do not collapse margin with in-flow children." /> 12 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 13 <style type="text/css"> 14 div 15 { 16 font: 20px/1em Ahem; 17 height: 5em; 18 width: 5em; 19 } 20 #div1 21 { 22 height: 2em; 23 margin-top: 2em; 24 overflow: hidden; 25 } 26 #div2 27 { 28 height: 1em; 29 background: red; 30 margin-top: 2em; 31 } 32 </style> 33 </head> 34 <body> 35 <p>Test passes if there is <strong>no red</strong>.</p> 36 <div> 37 <div id="div1"> 38 <div id="div2"></div> 39 </div> 40 </div> 41 </body> 42 </html>