| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html lang="en"> |
| <head> |
| <title>Margin Collapsing: top margins</title> |
| <style type="text/css"> |
| .a { margin: 0; background: red; } |
| .b { margin: 2em 0 0 0; background: red; } |
| .c { margin: 0; background: red; } |
| .d { margin: 1em 0 0 0; background: green; color: white; } |
| </style> |
| </head> |
| <body> |
| <p>There should be no red below.</p> |
| <div class="a"> |
| <div class="b"> |
| <div class="c"> |
| <div class="d"> |
| This line should be green. |
| </div> |
| </div> |
| </div> |
| </div> |
| </body> |
| </html> |