设置z-index属性不生效且提示The position: static property prevents z-index from having an effect.Try setting position to something other than static.
原因
父元素设置了position: relative; 子元素没有设置position
解决方法
这样就能实现two盒子覆盖在one盒子上
.box {
position: relative;
.one {
width: 100%;
position: absolute;
top: 0px;
z-index: 0;
}
.two{
padding-top: 20px;
z-index: 1;
}
}