<button class="elementor-button">
Effect Button
</button>
<button class="elementor-button green">
Effect Button
</button>
<button class="elementor-button blue">
Effect Button
</button>
<button class="elementor-button red">
Effect Button
</button>
<button class="elementor-button orange">
Effect Button
</button>
@keyframes onHoverButtonAnimation {
0% {
width: 0%;
left: 50%;
}
25% {
width: 25%;
left: 38%;
}
100% {
left: 0%;
width: 100%;
}
}
.bg-overly {
position: absolute;
left: 50%;
top: 0;
width: 0%;
height: 100px;
background-color: #231815;
z-index: -1;
}
.elementor-button:hover .bg-overly {
animation-name: onHoverButtonAnimation;
animation-duration:0.2s;
animation-iteration-count: 1;
animation-fill-mode: forwards;
}
.elementor-button {
position: relative;
overflow: hidden;
background-color: transparent;
height: 50px;
width: 300px;
font-size: 20px;
cursor: pointer;
border: 1px solid #000000;
margin: 10px;
}
.elementor-button:hover {
color: white;
}
.green {
color: green;
border: 1px solid green;
}
.blue {
color: blue;
border: 1px solid blue;
}
.red {
color: red;
border: 1px solid red;
}
.orange {
color: orange;
border: 1px solid orange;
}
.green .bg-overly {
background-color: green;
}
.blue .bg-overly {
background-color: blue;
}
.red .bg-overly {
background-color: red;
}
.orange .bg-overly {
background-color: orange;
}
$(function () {
$(".elementor-button").append('<div class="bg-overly"></div>');
});
This Pen doesn't use any external CSS resources.