.father {
position: relative;
width: 100px;
height: 100px;
background-color: #ccc;
}
.son1 {
position: absolute;
top: 75px;
left: 0;
background-color: purple;
z-index: 3;
}
.son2 {
position: absolute;
top: -25px;
left: 0;
background-color: red;
z-index: 0;
}
.father2 {
z-index: 4/3;(只要不低于3)
}
<>
<>
<>
<>
</>
</>
<>
<>
<>
<>
<>
</>
</>
如father2的层级比father1高,虽然其子元素son2的层级比son1低,但是依然son2盖住了son1