在两个盒子嵌套时候,内部的盒子设置的margin-top会加到外边的盒子上,导致内部的盒子margin-top设置失败,解决方法如下:
1、外部盒子设置一个边框 border
2、外部盒子设置 overflow:hidden
3、使用伪元素类:
.clearfix:before{
content: '';
display:table;}
margin-top 塌陷 的解决方案
猜你喜欢
转载自blog.csdn.net/binlety/article/details/81431443
今日推荐
周排行