margin-collapse-126.xht (855B)
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/026.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-top: 1em red solid; border-bottom: 1em lime solid; } 10 .test { border-top: 1em solid lime; margin-top: -1em; } 11 </style> 12 </head> 13 <body> 14 <p>There should be no red below.</p> 15 <div class="container"> 16 <div class="test"></div> 17 </div> 18 19 20 </body> 21 </html>