Skip to content
Related Articles
Open in App
Not now

Related Articles

What does the CSS rule “clear: both” do?

Improve Article
Save Article
  • Last Updated : 15 Feb, 2019
Improve Article
Save Article

The clear property is used to specify that which side of floating elements are not allowed to float. It sets or returns the position of the element in relation to floating the objects.

The “clear: both” means floating the elements are not allowed to float on both sides. It is used when no need of any element float on the left and right side as related to the specified element and wanted the next element only shown below. It also indicates that no other element takes up space on the left and right side.




<!DOCTYPE html> 
            div { 
                float: left; 
            p.GFG { 
                clear: both; 
            h1 { 
        <p>GeeksforGeeks: A computer science portal for geeks</p
        <p class="GFG">GeeksforGeeks</P


Supported Browsers: The supported browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!