CSS Clearfix with Pseudo Selector

Opposed to adding an “Empty Div” or  “Overflow” to clear floats, you can use the CSS pseudo selector (:after) to clear floats.

.clearfix:after { 
   content: "."; 
   visibility: hidden; 
   display: block; 
   height: 0; 
   clear: both;
}

 

Similar Posts