Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Clear Fix (See related posts)

// Clears floats that do not automatically force the container's bottom edge down as the float is made taller.

   1  
   2  /* Hacks/Misc */
   3  .cf:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
   4  * html .cf {height: 1%;}

Comments on this post

jbjaaz posts on May 04, 2006 at 21:59
IE 7 fixes their height bug but doesn't add support for :after. Therefore, above needs to be tweaked.

   1  .cf:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
   2  .cf { display:inline-block; } /*this trips hasLayout for ie7*/
   3  .cf { display:block; } /*this returns it back to normal*/


be sure to feed

   1  .cf { display:inline-block; }
to ie5 for the mac
   1  .cf { height:1% }
for ie6 and below


source: http://www.456bereastreet.com/archive/200603/new_clearing_method_needed_for_ie7/

You need to create an account or log in to post comments to this site.


Click here to browse all 5349 code snippets

Related Posts