Пожалуйста, кто-нибудь может мне объяснить это: почему, черт возьми, z-index
не работает?
html,body,div {margin:0;padding:0;}
.bz {
position: absolute;
z-index: 1;
display: block;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 25px;
height: 25px;
border: 2px solid #000;
background: #0f0;
border-radius: 50%;
}
.bz:before {
content: '';
display: block;
position: absolute;
z-index: -1;
bottom: 0;
right: 0;
width: 8px;
height: 25px;
transform: rotate(315deg);
background: #f00;
}
.bz:after {
content: '';
display: block;
position: absolute;
z-index: -1;
bottom: 0;
right: 0;
width: 8px;
height: 25px;
transform: rotate(45deg);
background: #00f;
}
<div class="bz">
</div>
в этом случае псевдоэлементы не должны перекрывать исходный, верно?
Я немного поиграл (да!) И обнаружил, что z-index
работает правильно на самих псевдоэлементах:
:after
(z-index: 0
) >
:before
(z-index: 0
)
:after
(z-index: -1
) <
:before
(z-index: 1
)
Так что, черт возьми, здесь происходит?!