margin-collapse-clear-015.xht (2218B)
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: Margin collapsing with clearance - Margins collapsing of an element's top margin with its first in-flow child should not be affected by clear and clearance</title> 8 9 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins" /> 10 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 11 <link rel="author" title="Bruno Fassino" href="fassino[at]gmail.com" /> 12 <link rel="match" href="margin-collapse-clear-015-ref.xht" /> 13 14 <meta content="When an element with clear set to it (to other than 'none') has a first in-flow child and their top margins are adjoining, then these margins should collapse normally." name="assert" /> 15 16 <style type="text/css"><![CDATA[ 17 #rel-pos-wrapper {position: relative;} 18 19 #parent-lime 20 { 21 background-color: lime; 22 border-top: black solid 1px; 23 width: 50%; 24 } 25 26 #float-left-blue 27 { 28 background-color: blue; 29 float: left; 30 height: 100px; 31 width: 100px; 32 } 33 34 #clear-left {clear: left;} 35 36 #clear-left > div 37 { 38 background-color: aqua; 39 height: 60px; 40 margin-top: 140px; 41 } 42 43 #next-yellow 44 { 45 background-color: yellow; 46 height: 100px; 47 } 48 49 .ref-overlapped-red 50 { 51 background-color: red; 52 left: 0; 53 position: absolute; 54 z-index: -1; 55 } 56 57 #ref1 58 { 59 height: 200px; 60 top: 1px; 61 width: 50%; 62 } 63 64 #ref2 65 { 66 height: 100px; 67 top: 201px; 68 width: 100%; 69 } 70 ]]></style> 71 72 </head> 73 74 <body> 75 76 <p>Test passes if there is <strong>no red</strong>.</p> 77 78 <div id="rel-pos-wrapper"> 79 80 <div id="parent-lime"> 81 <div id="float-left-blue"></div> 82 <div id="clear-left"> 83 <div></div> 84 </div> 85 </div> 86 87 <div id="next-yellow"></div> 88 89 <!-- 90 #ref1 and #ref2 boxes create a sort of 'reference rendering' 91 where #ref1 should be covered, overlapped by #parent-lime 92 while #ref2 should be covered, overlapped by #next-yellow. 93 --> 94 95 <div id="ref1" class="ref-overlapped-red"></div> 96 <div id="ref2" class="ref-overlapped-red"></div> 97 98 </div> 99 100 </body> 101 </html>