پیشنمایش زنده
کد HTML
<button class="button">
Hover Me
</button>
کد CSS
.button {
display: inline-block;
padding: 15px 32px;
font-size: 17px;
font-weight: bold;
color: rgb(0, 0, 0);
background: transparent;
border-radius: 50px;
text-align: center;
text-decoration: none;
cursor: pointer;
position: relative;
overflow: hidden;
z-index: 1;
border-style: solid;
border: none;
color: white;
}
.button:before,
.button:after {
content: "";
position: absolute;
top: 0;
width: 100%;
height: 100%;
opacity: 0.3;
pointer-events: none;
}
.button:before {
left: 90%;
background: linear-gradient(130deg, rgb(6, 193, 255), rgb(255, 255, 255), rgba(253, 28, 197, 0.985));
z-index: -1;
transition: left 0.3s ease-in-out;
}
.button:hover:before {
left: 50%;
}
.button:after {
right: 90%;
background: linear-gradient(130deg, rgb(6, 193, 255), rgb(255, 255, 255), rgba(253, 28, 197, 0.985));
z-index: -1;
transition: right 0.3s ease-in-out;
}
.button:hover:after {
right: 50%;
}