Clearfix css / Clearfix : after to clear all floats. Full code.

This article was written by in May 9, 2014, & may not be posted on other sites!
Original source url for this article: Clearfix css / Clearfix : after to clear all floats. Full code.

Clearfix css / Clearfix : after to clear all floats. Full code.
If you are floating elements you might need to clear all floats before your next div starts to avoid problems. This is how to create a css clearfix : after to clear all floats.

Clearfix css / Clearfix : after to clear all floats. Full code tutorial.

Clearfix css / Clearfix : after to clear all floats. Full code.

  1. Add the folowing code in your css to create a clearfix class:
    .clearfix:after{
    visibility: hidden;
    display: block;
    content: " ";
    clear: both;
    height: 0;
    }
  2. When you have any div with floating elements inside it, add the code class="clearfix" to the div. This will clear all floats after the div not affecting other elements.

 

Spread the word

Facebooktwittergoogle_pluslinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *