Is it possible to set the stacking order of pseudo-elements below their parent element? [duplicate]

問題:

This question already has answers here : 這個問題在這裏已經有了答案
Closed 1 year ago . 1 年前關閉。

I am trying to style a element with the :after pseudo element CSS selector我正在嘗試使用:after僞元素 CSS 選擇器設置元素樣式

#element {
    position: relative;
    z-index: 1;
}

#element::after {
    position:relative;
    z-index: 0;
    content: " ";
    position: absolute;
    width: 100px;
    height: 100px;
}

It seems like the ::after element can not be lower then the element itself.似乎::after元素不能低於元素本身。

Is there a way to have the pseudo element lower then the element itself?有沒有辦法讓僞元素低於元素本身?


解決方案:

參考一: https://en.stackoom.com/question/Ciz2
參考二: https://stackoom.com/question/Ciz2
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章