wpt / css / CSS2 / box-display / block-in-inline-margin-collapses-through-intervening-float.html

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

/css/CSS2/box-display/block-in-inline-margin-collapses-through-intervening-float.html

<!DOCTYPE html>
<title>CSS Test: block-in-inline margin collapses through an intervening float</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="help" href="https://www.w3.org/TR/CSS21/visuren.html#floats">
<link rel="match" href="block-in-inline-margin-collapses-through-intervening-float-ref.html">
<meta name="assert" content="A floated box between two block-in-inlines does not consume the preceding block's margin-bottom; it collapses with the following block-in-inline as if the float were not there.">
<style>
.container { width: 200px; }
.first { width: 200px; height: 20px; margin-bottom: 40px; background: blue; }
.intervening { float: left; width: 80px; height: 60px; background: yellow; }
.second { width: 200px; height: 20px; background: blue; }
</style>
<p>Two blue rectangles separated by a 40px gap; a yellow float intersects the second.</p>
<div class="container">
    <span><div class="first"></div></span>
    <div class="intervening"></div>
    <span><div class="second"></div></span>
</div>

/css/CSS2/box-display/block-in-inline-margin-collapses-through-intervening-float-ref.html

<!DOCTYPE html>
<title>CSS Reference</title>
<style>
.container { width: 200px; }
.first { width: 200px; height: 20px; margin-bottom: 40px; background: blue; }
.intervening { float: left; width: 80px; height: 60px; background: yellow; }
.second { width: 200px; height: 20px; background: blue; }
</style>
<p>Two blue rectangles separated by a 40px gap; a yellow float intersects the second.</p>
<div class="container">
    <div class="first"></div>
    <div class="intervening"></div>
    <div class="second"></div>
</div>