Button Hover Styles
by elizabethkmathew
HTML
<div class="btn-wrapper">
<div class="btn">
View More
</div>
</div>
<a class="button-color-change" href="#">
View More
</a>
CSS
.btn-wrapper {
margin-top: 50px;
margin-left: 100px;
position: relative;
height: 40px;
width: 150px;
margin-bottom: 50px;
}
.btn {
background-color: #fff;
border: 2px solid #073061;
display: flex;
justify-content: center;
align-items: center;
position: relative;
z-index: 5;
width: 100%;
height: 100%;
transition-duration: .4s;
transition-timing-function: cubic-bezier(0,.56,.44,1);
transition-property: transform;
transform: translate(0, 0);
}
.btn-wrapper::after {
content: "";
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: #073061;
transform: translate(0, 0);
}
.btn-wrapper:hover .btn {
transform: translate(-5px, -5px);
}
.btn-wrapper:hover:after {
transform: translate(5px, 5px);
}
.button-color-change {
text-decoration: none;
font-size: 16px;
font-weight: 600;
padding: 15px 40px;
border-radius: 100px;
background: #7E3BD0;
color: #fff;
display: inline-block;
margin-left: 100px;
animation: color-change 1s infinite;
transition: background 0.3s ease-out;
}
@keyframes color-change {
0%, 100% {
background: linear-gradient(40deg,#ffd86f,#fc6262);
}
50% {
background: linear-gradient(40deg,#ff6ec4,#7873f5);
}
}