Another way to clear floating elements (FF, IE 6, IE 7, IE 8 Beta)

/ Published in: CSS
Save to your folder(s)

This method uses the "min-height" property to give "hasLayout" in IE 7, "height" property for IE 6 and the pseudo-element ":after" and "content" property for Gecko based and IE 8 Beta.

Copy this code and paste it in your HTML
  1. .clearfix:after{content: ""; display: block; clear: both; height: 0; visibility: hidden;}
  2. .clearfix{min-height: 0; height: 0;}
  3. html>body .clearfix{height: auto;}


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.