margin-collapse-018.xht (1787B)
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 - element with clearance</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="clearance-006-ref.xht" /> 8 9 <meta name="flags" content="ahem image" /> 10 <meta name="assert" content="An element that has clearance applied to it will not collapse its top margin with its parent's bottom margin." /> 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-4em-space.png'); 21 height: 6em 22 } 23 .class1 24 { 25 background: green; 26 height: 1em; 27 } 28 #div2 29 { 30 margin-bottom: 1em; 31 } 32 #div3 33 { 34 float: left; 35 height: 3em; 36 } 37 #div4 38 { 39 clear: both; 40 margin-top: 1em; 41 } 42 </style> 43 </head> 44 <body> 45 <p>Test passes if there is no red.</p> 46 <div id="div1"> 47 <div class="class1"></div> 48 <div id="div2"> 49 <div id="div3"></div> 50 <div id="div4"></div> 51 </div> 52 <div class="class1"></div> 53 </div> 54 </body> 55 </html>