Ah, indeed! Check out the snippet provided below [JSfiddle] on either Firefox or IE.¹
.case { width:200px; background-color:yellow; }
.container { background-color:lightblue; margin-bottom:70px; padding-top:0.01px; }
.preface { float:left; height: 58px; width: 100px; border: 1px solid red; }
.one .intro { clear: left; margin-top:60px; }
.two .intro { clear: left; margin-top:59px; }
<div class="case one">
<div class="container">
<div class="preface">
lorem ipsum
</div>
<div class="intro"></div>
</div>
after
</div>
<hr>
<div class="case two">
<div class="container">
<div class="preface">
lorem ipsum
</div>
<div class="intro"></div>
</div>
after
</div>
(The scenarios are almost identical except for the class name "one" or "two" and their specific CSS styles. The padding-top:0.01px;
prevents the margins from collapsing between elements)
When an element's box moves down due to a specified clear
value, it is said to have clearance. This can be seen in case two. In contrast, in case one, although the box has clear:left
, its top margin is sizable enough that no clearance is needed.
Take a look at the outcome.
In case one, the 70px bottom margin of the container collapses with the top-margin of the .intro div, resulting in a 70px space between the .container div and the text "after". Conversely, in case two, due to the presence of clearance in the .intro div, as per the CSS specifications, the bottom margin of the container does not collapse with the top margin of the .intro div. Thus, the top-margin is applied first, followed by the container's bottom margin, creating distinct background areas.
¹Regrettably, Chrome does not handle this situation correctly.