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