margin-collapse-141.xht (1545B)
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: top margins</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/041.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 .test { background: aqua; margin: 0; width: 6em; border: solid; } 10 .test .a { height: 1em; background: fuchsia; margin: 0; } 11 .test .b { background: red; margin: 0; } 12 .test .c { float: left; height: 1em; width: 3em; background: orange; margin: 0; } 13 .test .d { height: 1em; background: yellow; margin: 1em 0 0 0; } 14 .control { width: 6em; border: solid; } 15 .control .a { border-top: fuchsia 1em solid; } 16 .control .b { border-top: aqua 1em solid; } 17 .control .c { border-left: orange 3em solid; border-right: yellow 3em solid; height: 1em; } 18 </style> 19 </head> 20 <body> 21 <p>The two boxes below should look identical.</p> 22 <table> 23 <tr> 24 <td> 25 <div class="test"> 26 <div class="a"></div> 27 <div class="b"> 28 <div class="c"></div> 29 <div class="d"></div> 30 </div> 31 </div> 32 </td> 33 <td> 34 <div class="control"> 35 <div class="a"></div> 36 <div class="b"></div> 37 <div class="c"></div> 38 </div> 39 </td> 40 </tr> 41 </table> 42 43 44 </body> 45 </html>