[英]How to deal with floated elements?
If there are floated elements in a parent element, they parent element looses its shape or has no height. 如果父元素中有浮动元素,则它们的父元素会失去其形状或没有高度。 How to deal with this problem?
该如何处理?
Thanks 谢谢
解决方案是使用clearfix类。
在父项上,执行以下操作:
style="overflow: auto"
Basically you have to wrap floated elements with a block that has a clearfix hack applied. 基本上,您必须使用应用了clearfix hack的块包装浮动元素。 Read more here: http://www.webtoolkit.info/css-clearfix.html
在此处阅读更多信息: http : //www.webtoolkit.info/css-clearfix.html
For IE<7 you would also use zoom:1; 对于IE <7,您还可以使用zoom:1;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.