clear-float-003.xht (1474B)
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: Clear floats handled after margin collapsing</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-float-003-ref.xht" /> 8 9 <meta name="assert" content="Clearance is introduced as spacing above the top margin after margin collapsing occurs." /> 10 <style type="text/css"> 11 #div1 12 { 13 height: 2in; 14 width: 2in; 15 } 16 #div2 17 { 18 background: red; 19 } 20 #div3 21 { 22 margin-top: 1in; 23 margin-bottom: 1in; 24 } 25 #div4 26 { 27 background: green; 28 clear: right; 29 margin-top: -1in; 30 } 31 #div2, #div4 32 { 33 float: right; 34 height: 1in; 35 width: 1in; 36 } 37 </style> 38 </head> 39 <body> 40 <p>Test passes if there is <strong>no red</strong>.</p> 41 <div id="div1"> 42 <div id="div2"></div> 43 <div id="div3"></div> 44 <div id="div4"></div> 45 </div> 46 </body> 47 </html>