<divclass="main">
<divclass="cot">wusuiw</div>
<divclass="cot">cdf</div>
</div>
<style type="text/css"> .cot{ margin-top: 20px; margin-bottom: 30px; } </style>
如图所示:
![]()
解答:因为网页的内容是从上而下慢慢堆叠的,margin不扩大父类的内容,所以margin-bottom不在父类里面,解决方法:改为padding-botttom或在父类加overflow:hidden或加设置border值或加float浮动(撑开父类);