A clearfix is a way for an element to automatically clear or fix its elements, so that do not need to add additional markup. It is generally used in float layout where elements are floated to be stacked horizontally. If the element is taller than the element containing it then use overflow property of CSS to overcome this.
In the above image logo is not fit into the div element. To fix this problem there are two ways. First is by increasing the height of the div block and second by the use of clearfix CSS property.
Example 1: In the code below problem is fixed without using overflow property.
Example 2: In this code, the problem is fixed using overflow property.
- Clearfix in Bootstrap
- HTML | <area> target Attribute
- HTML | DOM Video canPlayType( ) Method
- HTML | DOM Video play( ) Method
- HTML | <base> target Attribute
- Bootstrap 4 | Introduction
- HTML | <form> target Attribute
- HTML | DOM Video load( ) Method
- HTML | <ol> start Attribute
- How to get the current date and time in seconds?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.