请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

两个div 一个margin-bottom为10px,另一个 margin-top为10px,添加clearfix为什么还是10px,而不是20px

HTML代码如下:

<div style="border: 1px red solid; width: 400px; height: 100px;margin-bottom: 10px;" class="claerfix">

123

</div>

<div style="border: 1px red solid; width: 400px; height: 100px;margin-top: 10px; " class="claerfix">

123

</div>


CSS代码如下:

.claerfix:before,.clearfix:after{

content: " ";

display: table;

}

.claerfix:after{

clear:both;

}


效果如下:

https://img1.sycdn.imooc.com/szimg//5899e2ef0001eccc08360430.jpg


正在回答 回答被采纳积分+3

1回答

姜维 2017-02-15 15:57:38

clearfix 中间的拼写不统一

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号