margin-collapse-137.xht (1288B)
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: margins on relative boxes</title> 5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-06-27 --> 7 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/037.html" type="text/html"/> 8 <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#collapsing-margins"/> 9 <link rel="match" href="margin-collapse-137-ref.xht" /> 10 11 <meta name="flags" content="ahem" /> 12 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" /> 13 <style type="text/css"> 14 div { font: 20px/1 Ahem, sans-serif; } 15 .relative { position: relative; margin: 0 0 5em 0; } 16 .absolute { position: absolute; margin: 0; top: 0; left: 0; color: green; } 17 .static { position: static; margin: 0; color: red; } 18 </style> 19 </head> 20 <body> 21 <div class="relative"> 22 <div class="absolute"> 23 XXXXX 24 </div> 25 </div> 26 <div class="static"> 27 XXXXX 28 </div> 29 <p>Test passes if there is no red above.</p> 30 31 </body> 32 </html>