Clearfix is used to easily clear floats by adding .clearfix to the parent element. It utilizes the micro clearfix as popularized by Nicolas Gallagher. It can also be used as a mixin.
Let's take an example to see how the clearfix can be used. Without the clearfix the wrapping div would not span around the buttons which would cause a broken layout.
One of the major problems with the structure of HTML is that if you have a child div inside parent div, the child div automatically flows around the parent div. The solution to this problem is using clear property of CSS.
Bootstrap allows us to use a class named clearfix which is used to clear the floated contents inside any container.