wpt / css / CSS2 / box-display / block-in-inline-self-collapsing-only-child.html

Status: PASS | Duration: 8ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/CSS2/box-display/block-in-inline-self-collapsing-only-child.html

<!DOCTYPE html>
<title>CSS Test: self-collapsing block-in-inline as only child of parent</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-self-collapsing-only-child-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<meta name="assert" content="A self-collapsing block-in-inline that is the only child of its parent collapses all adjoining margins through both itself and its parent.">
<style>
.prior { width: 100px; height: 20px; background: green; }
.parent { width: 100px; font: 20px/1 Ahem; }
.empty { width: 100px; height: 0; margin-top: 30px; margin-bottom: 40px; background: red; }
.next { width: 100px; height: 20px; background: green; }
</style>
<p>Two green squares with a 40px gap; no red.</p>
<div class="prior"></div>
<div class="parent">
    <span><div class="empty"></div></span>
</div>
<div class="next"></div>

/css/CSS2/box-display/block-in-inline-self-collapsing-only-child-ref.html

<!DOCTYPE html>
<title>CSS Reference</title>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<style>
.prior { width: 100px; height: 20px; background: green; }
.gap { width: 100px; height: 40px; background: white; }
.next { width: 100px; height: 20px; background: green; }
</style>
<p>Two green squares with a 40px gap; no red.</p>
<div class="prior"></div>
<div class="gap"></div>
<div class="next"></div>