1、边界重叠是指两个或两个以上盒子的相邻边界重合在一起,构成单一边界。
可以相邻也可以嵌套,其中没有非空内容、补白、边框。
.neighbor{
height: 100px;
background: red;
}
.father{
background: #f436365e;
}
.child{
height: 100px;
margin-top: 10px;
background: #00800047;
}
<div>
this is neighbor
</div>
<div>
<div>
this is child
</div>
</div>
2、这两个或两个以上块级盒的垂直邻接边界重合,其边界宽度为相邻边界宽度的值。
请注意,水平线不重合。
<style type="text/css">
.father{
background: #f436365e;
overflow: hidden;
}
.child{
height: 20px;
margin: 30px auto 30px;
background: #00800047;
}
</style>
<div>
<div>
this is child1
</div>
<div>
this is child2
</div>
<div>
this is child1
</div>
</div>
以上就是css边距重叠的介绍,希望对大家有所帮助。更多css学习指路:css教程
本文教程操作环境:windows7系统、css3版,DELL G3电脑。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有