Posted By

Huskie on 01/07/12


Tagged

css clear float clearing floats best practice guideline


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

maltem
mr2p


Best Method for Clearing Floats


 / Published in: CSS
 

URL: http://darrenhuskie.com/

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.

  1. .clear-fix:after{clear:both;content:'.';display:block;line-height:0;height:0;visibility:hidden;}
  2. .clear-fix{zoom:1;}

Report this snippet  

You need to login to post a comment.