Best Method for Clearing Floats


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

In my opinion, this is the best cross-browser method of clearing floated elements in a container. Remember to add .clear-fix{zoom:1;} to an IE specific stylesheet, otherwise IE 7 will complain.


Copy this code and paste it in your HTML
  1. .clear-fix:after{clear:both;content:'.';display:block;line-height:0;height:0;visibility:hidden;}
  2. .clear-fix{zoom:1;}

URL: http://darrenhuskie.com/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.