It is clear to me (pun intended) that the two best ways to implement clearfix is either through Nicolas Gallager's micro-version .cf { *zoom: 1; }
, or using overflow: hidden
.
But should either clearfix be used when there's nothing to fix? (Pun intended, again.)
In other words, if you have a container like article
or section
simply for semantic reasons — which doesn't have a background or any visual effect (like is sought after in this example), but has floated elements inside — should you still clearfix it?
Why do I ask?
Well, clearly something is wrong because if you bring up the container in a web inspector you won't see the container highlighted, for example it is only an invisible slither:
(And in Firefox Tilt, which visualizes websites in 3D, there is an empty space where the container block should be when you turn the website 90-degrees.)
But does it matter?
My reasoning so far:
Surely, if you decided to use the container for visual/layout purposes in the future, you'd see that it's not behaving properly, and you'd apply a clearfix hack then. But, what else is there to consider?