Himas Rafeek
Posted on: 1 year ago
CSS

Best Method for Clearing Floats

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.


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

Related Snippets