To offer an update on the situation on Q2 of 2017.
A new CSS3 display property is available in Firefox 53, Chrome 58 and Opera 45.
.clearfix {
display: flow-root;
}
Check the availability for any browser here: http://caniuse.com/#feat=flow-root
The element (with a display property set to flow-root) generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents.
Meaning that if you use a parent div containing one or several floating children, this property is going to ensure the parent encloses all of its children. Without any need for a clearfix hack. On any children, nor even a last dummy element (if you were using the clearfix variant with :before on the last children).
.container {_x000D_
display: flow-root;_x000D_
background-color: Gainsboro;_x000D_
}_x000D_
_x000D_
.item {_x000D_
border: 1px solid Black;_x000D_
float: left;_x000D_
}_x000D_
_x000D_
.item1 { _x000D_
height: 120px;_x000D_
width: 120px;_x000D_
}_x000D_
_x000D_
.item2 { _x000D_
height: 80px;_x000D_
width: 140px;_x000D_
float: right;_x000D_
}_x000D_
_x000D_
.item3 { _x000D_
height: 160px;_x000D_
width: 110px;_x000D_
}
_x000D_
<div class="container">_x000D_
This container box encloses all of its floating children._x000D_
<div class="item item1">Floating box 1</div>_x000D_
<div class="item item2">Floating box 2</div> _x000D_
<div class="item item3">Floating box 3</div> _x000D_
</div>
_x000D_