里面的div怎么撑开外面的div让高度自适应

如题所述

第1个回答  2015-02-08
里面div高度设置成自动,外面的设置一个 最小高度就行了
第2个回答  推荐于2016-07-22
清除浮动 在最后一个div 后面加上 这句话

<div style="clear:both;height:1px;width:100%; overflow:hidden; margin-top:-1px;"></div>

--------------------------------------------------------------------------------------------------------------------

<body>
<div style="width:580px; height:auto; margin:0 auto; background-color:#333">
<div style="height:100px; width:230px; float:left; background-color:#CCC; margin:20px"></div>
<div style="height:100px; width:230px; float:left; background-color:#CCC; margin:20px"></div>
<div style="height:100px; width:230px; float:left; background-color:#CCC; margin:20px"></div>
<div style="clear:both;height:1px;width:100%; overflow:hidden; margin-top:-1px;"></div>
</div>
</body>本回答被提问者和网友采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网