[英]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.