关于上部盒子里有图片下面盒子magin-top负值的层级问题

.box{
width: 800px;
box-sizing: border-box;
margin: 50px auto 0;
background: pink;
}
.imgBox{
width: 80%;
height: 500px;
margin: 0 auto;
background: green;
}
.imgBoximg{
display: block;
width: 100%;
height: auto;
height: 500px;
}
.boxc{
width: 100%;
height: 300px;
background: #c00;
margin-top: -100px;
position: relative;
加入这行样式即可调整下面盒子的层级
}
<div class="box"> <div class="imgBox"> <img class="imgBoximg" src="img/plt1.png" alt="" /> </div> <div class="boxc"></div> </div>

浙公网安备 33010602011771号