Is clearfix a good technique for float clearing in css
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
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.
精彩评论