开发者

Is clearfix a good technique for float clearing in css

开发者 https://www.devze.com 2023-02-12 15:02 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号