概念浏览器
所谓盒子模型,就像一个盒子,一个标签就是一个盒子,能够经过6大属性( 有margin(外边距),border(边框),padding(内边距),widht(宽度),height(高度),background(背景))来设置这个盒子。spa
<style>
.father{
width: 960px;
height: 100px;
background: red;
}
.son{
background: yellow;
height: 50px;
}
</style>
<body>
<div class="father">
<div class="son">
</div>
</div>
</body>
复制代码
重叠前提:块级元素 垂直3d
兄弟元素之间的重叠:code
解决: 块级元素-->非块级元素 浮动 设置一方盒子margin,不要两个都设置cdn
父子(第1个子或最后1个子)元素之间的重叠:blog
父的margin-top 和 子的margin-top ---> 取大优先it
父的margin-bottom 和 子的margin-bottom ---> 取大优先io
解决: 男-->非男 border paddingclass