I'm trying to place the :before
,:after
box-shadow
behind the button. But the transition is starting in front of the a tag. For my works CMS, I'll need all the properties to be on the a tag.
<a href="#" class="btn">Join Today</a>
.btn{
position: relative;
z-index: 1;
display: inline-block;
text-align: center;
background-color: #8ec656;
border-radius: 30px;
font-family: 'Roboto Condensed', sans-serif;
font-size: 20px;
color: #fff;
border: 3px #d2d2d2 solid;
padding: 15px 40px;
line-height: 1;
transition: box-shadow .4s;
}
.btn:hover{
background: #6b9640;
box-shadow: inset 0px -22px 13px 0px #84b652, inset 0px 2px 5px 0px #84b652;
}
.btn:before,
.btn:after{
content: "";
position: absolute;
z-index: -1;
bottom: 9px;
left: 10px;
width: 88%;
top: 73%;
transition: box-shadow .4s;
}
.btn:hover:before,
.btn:hover:after{
box-shadow: 0 15px 10px #777;
}
.btn:before,
.btn:after{
transition: .6s;
content: "";
box-shadow: 0 28px 17px -3px #777;
width: 84%;
height: 11px;
top: 48%;
left: 15px;
position: absolute;
opacity: 0;
}
.btn:hover:before,
.btn:hover:after{
opacity: 1;
}
This is what I had to settle with. Thank you for your responses!