开发者

How to deal with floated elements?

开发者 https://www.devze.com 2022-12-22 08:27 出处:网络
If there are floated elem开发者_如何学JAVAents in a parent element, they parent element looses its shape or has no height. How to deal with this problem?

If there are floated elem开发者_如何学JAVAents in a parent element, they parent element looses its shape or has no height. How to deal with this problem?

Thanks


The solution to that is using clearfix class.


On the parent, do a:

 style="overflow: auto"


Basically you have to wrap floated elements with a block that has a clearfix hack applied. Read more here: http://www.webtoolkit.info/css-clearfix.html

For IE<7 you would also use zoom:1;

0

精彩评论

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