We Recommend

CSS: The Definitive Guide CSS: The Definitive Guide
Provides you with a comprehensive guide to CSS implementation, along with a thorough review of all aspects of CSS 2.1. Updated to cover Internet Explorer 7, Microsoft's vastly improved browser, this new edition includes content on positioning, text wrapping (nowrap), lists and generated content, table layout, user interface, paged media, and more.


Posted By

sendoa on 01/05/07


Tagged

clear cleared


Versions (?)


Cleared elements


Published in: CSS 


Hacer que un contenedor que contiene floats los abarque enteros, es decir, que realmente los contenga.

BastarĂ­a con aplicar la clase .clearfix al contenedor

  1. /* Para FF, Opera, etc. */
  2. .clearfix:after {
  3. content: ".";
  4. display: block;
  5. height: 0;
  6. clear: both;
  7. visibility: hidden;
  8. }
  9.  
  10. /* Para IE 5.x, 6, 7 */
  11. <!--[if IE]>
  12. <style>
  13. .clearfix {display: inline-block;}
  14. /* Hides from IE-mac \*/
  15. * html .clearfix {height: 1%;}
  16. .clearfix {display: block;}
  17. /* End hide from IE-mac */
  18. </style>
  19. <![endif]-->

Report this snippet 

You need to login to post a comment.