Sometimes, you will encounter situations where you will have a parent container that contains all floated elements in it, which will make the height of it collapse to literally nothing. This can create problems with older browsers or some cross browser issues can occur as well. Collapsing almost always needs to be dealt with by clearing the float after the floated elements but before the close of the container.
There are a few ways to go about doing this. The first is adding an empty
The most effective way to clearfix is to make use of the newer psuedo element :after. By adding this psuedo element, and applying a small amount of CSS to it:
.clearfix:after {
content: ".";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
This will create a small bit of content that is hidden from view, but exists on the page still in order to clear the floats.