| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html lang="en"> |
| <head> |
| <title>Margin Collapsing: top margins</title> |
| <style type="text/css"> |
| .test { background: aqua; margin: 0; width: 6em; border: solid; } |
| .test .a { height: 1em; background: fuchsia; margin: 0; } |
| .test .b { background: red; margin: 0; } |
| .test .c { float: left; height: 1em; width: 3em; background: orange; margin: 0; } |
| .test .d { height: 1em; background: yellow; margin: 1em 0 0 0; } |
| .control { width: 6em; border: solid; } |
| .control .a { border-top: fuchsia 1em solid; } |
| .control .b { border-top: aqua 1em solid; } |
| .control .c { border-left: orange 3em solid; border-right: yellow 3em solid; height: 1em; } |
| </style> |
| </head> |
| <body> |
| <p>The two boxes below should look identical.</p> |
| <table> |
| <tr> |
| <td> |
| <div class="test"> |
| <div class="a"></div> |
| <div class="b"> |
| <div class="c"></div> |
| <div class="d"></div> |
| </div> |
| </div> |
| </td> |
| <td> |
| <div class="control"> |
| <div class="a"></div> |
| <div class="b"></div> |
| <div class="c"></div> |
| </div> |
| </td> |
| </tr> |
| </table> |
| </body> |
| </html> |