clear-clearance-calculation-003.xht (2010B)
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: Clearance calculations - clear box collapsing margins</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#flow-control" /> 7 <link rel="match" href="clear-clearance-calculation-003-ref.xht" /> 8 9 <meta name="assert" content="When a cleared element has more top margin than the height of the floated element the margin is collpased with previous in-flow children. The element is then placed at the point of the resulting collapsed margin." /> 10 <!-- C1 = H-MT2 --> 11 <!-- C2 = Max(M1, MT2, MB2) - M1 - MT2 --> 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 width: 5em; 18 } 19 #parent 20 { 21 background: url('support/clear-clearance-calculation-003.png'); 22 min-height: 7em; 23 position: relative; 24 } 25 #div1 26 { 27 margin-bottom: 1em; 28 } 29 #div2 30 { 31 float: left; 32 margin: 0; 33 } 34 #div3 35 { 36 background: red; 37 clear: left; 38 margin-bottom: 5em; 39 margin-top: 4em; 40 } 41 #div1, #div2, #div4 42 { 43 background: green; 44 height: 1em; 45 } 46 </style> 47 </head> 48 <body> 49 <p>Test passes if there is no red.</p> 50 <div id="parent"> 51 <div id="div1"></div> 52 <div id="div2"></div> 53 <div id="div3"></div> 54 <div id="div4"></div> 55 </div> 56 </body> 57 </html>