如何安排:在具有position: absolute
和z-index: -1
的{{1}}和position: absolute
的伪元素之前或之后:z-index: 1
和#element {
position: absolute;
z-index: 1;
width: 100px;
height: 100px;
background-color: blue;
}
#element::after {
content: "";
width: 150px;
height: 150px;
background-color: red;
position: absolute;
top: 20px;
z-index: -1;
}
https://jsfiddle.net/x5x6ye97/2/
<div id="element"></div>
&#13;
Annie 101 56 89
Joy 102 78 56
rinken 103 45
&#13;
答案 0 :(得分:1)
嗯,我觉得你想要实现这个......
以下是工作代码 -
#element {
position: relative; /* optional */
width: 100px;
height: 100px;
background-color: green;
}
#element::after {
content: "";
width: 150px;
height: 150px;
background-color: yellow;
position: absolute;
z-index: -1;
}
<div id="element"></div>
希望这会对您有所帮助:)