margin-collapse-135.xht (1289B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Margin Collapsing: negative margins with clear</title> 5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 6 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/035.html" type="text/html"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"/> 8 <link rel="match" href="margin-collapse-135-ref.xht" /> 9 10 <style type="text/css"> 11 .container { background: red; height: auto; border: 1em lime solid; } 12 div { clear: both; } 13 .a { margin-top: 1em; margin-bottom: 1em; } 14 .b { margin-top: 1em; margin-bottom: 1em; } 15 .c { margin-top: 1em; margin-bottom: 1em; } 16 .d { margin-top: 1em; margin-bottom: 1em; } 17 .e { margin-top: 1em; margin-bottom: -1em; } 18 .f { margin-top: 1em; margin-bottom: 1em; } 19 </style> 20 </head> 21 <body> 22 <p>Test passes if there is <strong>no red</strong>.</p> 23 <div class="container"> 24 <div class="a"> 25 <div class="b"> </div> 26 <div class="c"> </div> 27 </div> 28 <div class="d"> 29 <div class="e"> </div> 30 <div class="f"> </div> 31 </div> 32 </div> 33 34 35 </body> 36 </html>