Clearfix

Quickly and easily clear floated content within a container by adding a clearfix utility.

Easily clear floats by adding .clearfix to the parent element.


<div class="clearfix">...</div>

The following example shows how the clearfix can be used. Without the clearfix, the wrapping div would not span the buttons, which would cause a broken layout.

<div class="bg-light clearfix">
  <button class="btn btn-secondary float-left">Example button floated left</button>
  <button class="btn btn-secondary float-right">Example button floated right</button>
</div>
Last updated July 5, 2022.