本文介绍了并排divs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个父div的4个div。为了让它们并排出现,我给了所有4个div一个float:left的样式。 div并排显示,但父div的高度不会增长到包含子div的高度。我错过了什么?
I've got 4 divs inside a parent div. To get them to appear side by side, I've given all 4 divs a style with float:left. The divs do appear side by side, but the parent div's height does not grow to encompass the height of the child divs. What am I missing?
推荐答案在4个div之后,您需要取消浮动样式。 这是通过创建ap来完成的,例如:< p style =clear:both>< / p> 您的父母div会自动获得正确的尺寸。
After the 4 divs, you need to "cancel" the float style. This is done through the creation of a p for example, like: <p style="clear: both"></p> Your parent div will automatically get the right size.
更多推荐
并排divs
发布评论