| <!DOCTYPE html> |
| <title>CSS Test: empty block-in-inline collapses through its own margins</title> |
| <link rel="help" href="https://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level"> |
| <link rel="help" href="https://www.w3.org/TR/CSS21/box.html#collapsing-margins"> |
| <link rel="match" href="block-in-inline-zero-height-margin-collapse-ref.html"> |
| <link rel="stylesheet" type="text/css" href="/fonts/ahem.css"> |
| <meta name="assert" content="A zero-height block-in-inline with margin-top and margin-bottom has its top and bottom margins adjoin and collapse together."> |
| <style> |
| .container { width: 100px; font: 20px/1 Ahem; } |
| .before { width: 100px; height: 20px; background: green; } |
| .empty { width: 100px; height: 0; margin-top: 30px; margin-bottom: 40px; background: red; } |
| .after { width: 100px; height: 20px; background: green; } |
| </style> |
| <p>Two green squares with a 40px gap; no red.</p> |
| <div class="container"> |
| <div class="before"></div> |
| <span><div class="empty"></div></span> |
| <div class="after"></div> |
| </div> |