CSS: display: flow-root
is better than the clearfix hack
Published on in CSS
The flow-root
value is clearer (no hacks!)
and has great browser support.
display: flow-root
is described on Can I use
like so:
The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents. It provides a better solution to the most use cases of the "clearfix" hack.
The browser support of the flow-root
value is excellent
(supported by all modern browsers).
That's quite funny,
because I don't remember hearing about this value before.
I also don't remember where I found it.