It sounds like in your situation a problem hasn't reared its ugly head, but I prefer to code defensively. What if you later try to add a border or background to the element containing the floats? It won't look right. Or what if you later make a change to the floats such that they don't consume the full available width? Then inline content that follows might sneak up to either side of the floats. In my opinion, you're trying to protect against future changes.
There are two problems you are trying to prevent when using clearfix:
- Containing descendant floats. This means that the element in question makes itself tall enough to wrap all floating descendants. (They don't hang outside.)
- Insulating descendants from outside floats. This means that descendants inside of an element should be able to use
clear: both
and have it not interact with floats outside the element.
It's important to use clearfix anytime an element contains floated descendants and you want to accomplish these two goals. I do this for all elements that contain floats. Read more in my answer to the same question.
(As you can probably tell from that post, I strongly disagree that "the two best ways to implement clearfix is either through Nicolas Gallager's micro-version .cf { *zoom: 1; }
, or using overflow: hidden
." I don't have a problem with zoom: 1
, but overflow: hidden
will clip anything that falls outside the bounds of the element.)