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

dhjapan on 12/12/07


Tagged

css clear float


Versions (?)


Who likes this?

6 people have marked this snippet as a favorite

vali29
basicmagic
iTony
sbbath
heinz1959
stoker


Clear Floats


Published in: CSS 


URL: http://dtott.com/thoughts/2007/12/10/clear-your-floats-the-right-way/

2 Façons d'englober correctement un/des block(s) en float

  1. /* HTML
  2. <#container>
  3. <float />
  4. <float />
  5. </#container>
  6. */
  7. /******** 1ere Methode *********/
  8. #container {
  9. overflow: auto;
  10. }
  11. * html #container {
  12. height: 1%;
  13. }
  14. /******** 2nd Methode *********/
  15. #container:after {
  16. content: ".";
  17. display: block;
  18. height: 0;
  19. clear: both;
  20. visibility: hidden;
  21. }
  22. #container {
  23. display: inline-block;
  24. }

Report this snippet 

You need to login to post a comment.