The code below stops the clearfix
parent element from collapsing when both of it's children are floated.
Can anyone tell me how / why it works?
.clearfix {
overflow: hidden; /* can also be "auto" */
}
<div class="clearfix">
<div style="float: left;">Div 1</div>
<div style="float: left;">Div 2</div>
</div>