[英]unable to make an absutely positioned pseudo element appear in front of its parent
我正在尝试在其父项下添加一个伪元素。 两者都是绝对定位的,但是伪元素仍然在其父级之上堆叠。
<div></div>
div{
position: absolute;
top: 10px;
left: 10px;
height: 20px;
width: 20px;
background: red;
z-index: 10;
}
div:before{
content: "";
position: absolute;
top: 0;
left: 0;
height: 40px;
width: 40px;
background: blue;
z-index: 1;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.