margin-collapse-023.xht (1764B)
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 - clearance applied to sibling</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="If an in-flow block-level sibling (#div4) has clearance applied to it, then it will not adjoin its top margin with the bottom margin of its previous in-flow sibling (#div2)." /> 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 #div3 19 { 20 float: left; 21 height: 3em; 22 } 23 #div1 24 { 25 background: url('support/margin-collapse-4em-space.png'); 26 height: 6em; 27 } 28 #div2 29 { 30 margin-bottom: 1em; 31 } 32 #div4 33 { 34 clear: both; 35 margin-top: 2em; 36 } 37 #div2, #div4 38 { 39 background: green; 40 height: 1em; 41 } 42 </style> 43 </head> 44 <body> 45 <p>Test passes if there is no red.</p> 46 <div id="div1"> 47 <div id="div2"></div> 48 <div id="div3"></div> 49 <div id="div4"></div> 50 </div> 51 </body> 52 </html>