clear-clearance-calculation-004.xht (1656B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Test: clear and clearance calculation - margin collapsing</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#flow-control" /> 11 <link rel="match" href="clear-clearance-calculation-004-ref.xht" /> 12 13 <meta content="With clear: left, the top border edge of the last paragraph must be below the floating paragraph, i.e., 50px lower. That means that the margin-bottom of the first paragraph must not collapse with the margin-top of the last paragraph and clearance must be added such that clearance + margin-top of last paragraph = 50px, i.e., clearance = 50px - margin-top of last paragraph = 50px - 75px = - 25px." name="assert" /> 14 15 <style type="text/css"><![CDATA[ 16 body {margin: 8px;} 17 18 #overlapped-red 19 { 20 background-color: red; 21 height: 100px; 22 left: 8px; 23 position: absolute; 24 right: 8px; 25 top: 108px; 26 z-index: -1; 27 } 28 29 #firstParg 30 { 31 height: 25px; 32 margin-bottom: 25px; 33 margin-top: 0px; 34 } 35 36 #floatingParg 37 { 38 float: left; 39 height: 50px; 40 margin: 0; 41 } 42 43 #lastParg 44 { 45 background-color: green; 46 clear: left; 47 height: 100px; 48 margin-top: 75px; 49 } 50 ]]></style> 51 52 </head> 53 54 <body> 55 56 <div id="overlapped-red"></div> 57 58 <p id="firstParg"></p> 59 60 <p id="floatingParg"></p> 61 62 <p id="lastParg"></p> 63 64 <p>Test passes if there is a wide green rectangle above and <strong>no red</strong>.</p> 65 66 </body> 67 </html>