margin-collapse-clear-009.xht (1682B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Margin Collapsing with Clearance</title> 5 <link rel="author" title="Microsoft" href="http://microsoft.com/"/> 6 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#flow-control"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"/> 8 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#floats"/> 9 <link rel="match" href="margin-collapse-clear-003-ref.xht" /> 10 11 <style type="text/css"> 12 div.target1 { position: absolute; left: -15px; height: 50px; width: 0; border-left: 10px solid yellow; top: 0px; } 13 div.target2 { position: absolute; left: -15px; height: 20px; width: 0; border-left: 5px solid aqua; top: 90px; } 14 div.target3 { position: absolute; left: -15px; height: 50px; width: 0; border-left: 10px solid orange; top: 110px; } 15 div.container { width: 150px; position: relative; margin-left: 20px; border: solid thin; } 16 div.box1 { height: 50px; margin-bottom: 40px; background-color: yellow; } 17 div.box2 { background-color: aqua; float: left; width: 20px; height: 20px; } 18 div.box3 { overflow: hidden; clear: left; margin-top: 50px; height: 50px; background-color: orange; } 19 </style> 20 </head> 21 <body> 22 <p>The coloured bars on the left should match the coloured boxes in the black box.</p> 23 <div class="container"> 24 <div class="target1"></div> 25 <div class="target2"></div> 26 <div class="target3"></div> 27 <div class="box1">A</div> 28 <div class="box2">B</div> 29 <div class="box3">C</div> 30 </div> 31 </body> 32 </html>