Question

I was using clearfix to clear the floating effect in CSS, but I was told that it's not really good technique and I should use something else. Is that true?

And if it is, are there other alternatives that would still make my CSS validated?

Many Thanks

Was it helpful?

Solution

You can also use this method http://www.quirksmode.org/css/clearing.html . Typically just apply overflow:hidden; or overflow:auto; and the container should expand around the floats. You’ll need a width for IE 6.

Also display:inline-block; careful IE is happy with it, (what else is new).

And in some circumstances you can just float the container, for the same effect, but floating the container may not always be desirable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top