html - Z-index not working on pseudo-element with clip-path -
i'm trying create border clip path using pseudo-elements. have tried change positioning in them , pseudoelement still stay on top of it. how can change this? can see code in here.
#shield { z-index: 1; background-color: red; box-shadow: 1px 1px 1px black; background-image: url("https://upload.wikimedia.org/wikipedia/commons/9/91/bras%c3%a3o_porto_feliz.png"); background-size: 50%; background-repeat: no-repeat; background-position: center; background-blend-mode: multiply; display: inline-block; height: 120px; width: 200px; -webkit-clip-path: polygon(100% 0, 100% 75%, 50% 100%, 0% 75%, 0 0); clip-path: polygon(100% 0, 100% 75%, 50% 100%, 0% 75%, 0 0); } #logo { width: 100px; height: 100px; } #shield::before { top: 0; left: 0; transform: scale(1.2); content:""; display: block; width: 100%; height: 100%; background-color: black; position: absolute; z-index: -1; }
<div class="navbar-brand navbar-brand-centered" id="shield"> </div>
to see wanted in top of things, delete ::before element
full example in here
thanks in advance :)
just flip around. use background image in ::after , black color actual div.
#shield { z-index: 1; background-color: black; box-shadow: 1px 1px 1px black; position: relative; display: inline-block; height: 120px; width: 200px; -webkit-clip-path: polygon(100% 0, 100% 75%, 50% 100%, 0% 75%, 0 0); clip-path: polygon(100% 0, 100% 75%, 50% 100%, 0% 75%, 0 0); } #logo { width: 100px; height: 100px; } #shield::before { top: 0; left: 0; transform: scale(1.2); content:""; display: block; width: 100%; height: 100%; background-image: url("https://upload.wikimedia.org/wikipedia/commons/9/91/bras%c3%a3o_porto_feliz.png"); background-repeat: no-repeat; background-position: center; background-blend-mode: multiply; position: absolute; z-index: 1; background-size: 50%; }
<div id="shield"></div>
Comments
Post a Comment