margin-collapse-129.xht (1183B)
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 (easy)</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/029.html" type="text/html"/> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"/> 8 <style type="text/css"> 9 .container { background: red; height: auto; border: 1em lime solid; } 10 .a { margin-top: -1em; margin-bottom: 1em; } 11 .b { margin-top: 1em; margin-bottom: 1em; } 12 .c { margin-top: 1em; margin-bottom: 1em; } 13 .d { margin-top: 1em; margin-bottom: 1em; } 14 .e { margin-top: 1em; margin-bottom: 1em; } 15 .f { margin-top: 1em; margin-bottom: 1em; } 16 </style> 17 </head> 18 <body> 19 <p>There should be no red below.</p> 20 <div class="container"> 21 <div class="a"> 22 <div class="b"> </div> 23 <div class="c"> </div> 24 </div> 25 <div class="d"> 26 <div class="e"> </div> 27 <div class="f"> </div> 28 </div> 29 </div> 30 31 32 </body> 33 </html>