I have a ripple effect set to a CSS class using a pseudo selector. I'd like that animation to run from behind the element itself, but I can't manage to find how to do so.
.button {
width: 50px;
height: 50px;
background: lightblue;
position: absolute;
top: 50px;
left: 50px;
}
i.ripple:before {
content: "";
position: absolute;
border-radius: 50%;
width: 30px;
height: 30px;
background: darkorange;
animation: ripple 2s ease-in infinite;
}
@keyframes ripple {
0% {transform: scale(1);opacity: .5;}
100% {transform: scale(8);opacity: 0;}
}
<i class="ripple button">test</i>
If you run the example, you will see that the orange circle is on top of the blue box from the .button class, I'd like it to be behind.
I think this issue is related to this other question: ::before pseudo-element stacking order issue But can't figure out much of it.