What is the best way to clear the CSS style "float"? -


I use my code as & brt; I'm very used to cleaning using br style = "clear: both" / & gt; But the content keeps changing and I'm not sure that this is the best practice

There is one (from positioneverything) available that allows you to get the same result without clearing the divi. But ... they claim that the hack is a bit old and instead you should probably see it. But .. after reading the comment through 700 pages :) It seems that some work can not be done later.

I would like to avoid any javascript hacks because I would like to do my clearing to work even though javascript is enabled.

What is the best practice for clearing the browser independently?

Update : In 2014, you should use clearfix technology that is pseudo Elements were used, as is the modern way of clearing floats described by @Radrigo Manguinho; For a more up-to-date method, see Micro Clearfix of Nicholas Gallagher:

For Modern Code * 1. * Space content is a way of avoiding opera bugs when * elsewhere in the satisfactory feature document is included. * Otherwise it becomes a place to appear in the upper and lower part of the elements * which are clearly evident. * 2. `` `` ```` instead of` block` is only used when the head of the hair element To use the margin, use * `: first`. * /. Cf: First,. Cf: after {content: ""; / * 1 * / display: table; / * 2 * /}. Cf: After {clear: both; } / ** * 6/7 only for IE * To include this rule, include the floats to trigger the lightweight. * /. Cf {* Zoom: 1; }

Original Answer:

I really do not like to use additional non-semantic markups, so I'm far from using clearing Want to stay Element Just apply the overflow: hidden to the float's parents to clear them. Cross browser works, no problem I believe overflow: auto; also works.

Obviously, if you want to use a different overflow property, this will not work, but due to the IE 6 extension box bug, I

.

There may be a reason deliberately overflowing your containers.


Comments