پیشنمایش زنده
کد HTML
<button class="button">
<span class="button-text">Hover me</span>
<div class="fill-container"></div>
</button>
کد CSS
.button {
--black: #000000;
--ch-black: #141414;
--eer-black: #1b1b1b;
--night-rider: #2e2e2e;
--white: #ffffff;
--af-white: #f3f3f3;
--ch-white: #e1e1e1;
position: relative;
padding: 24px 64px;
border-radius: 5px;
color: var(--night-rider);
font-weight: 600;
font-size: 1rem;
letter-spacing: 0px;
background-color: var(--white);
border: solid 1px var(--ch-white);
overflow: hidden;
cursor: pointer;
transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
font-family: Montserrat;
}
.button .button-text {
position: relative;
z-index: 2;
}
.button .fill-container {
position: absolute;
left: 0;
top: 50%;
width: 100%;
padding-bottom: 100%;
transform: translateY(-50%) rotate(180deg);
}
.button .fill-container::after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: var(--af-white);
border-radius: 50px;
transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
transform: translateY(-100%);
}
.button:hover {
transform: translateY(-4px);
color: var(--black);
}
.button:hover .fill-container {
transform: translateY(-50%) rotate(0);
}
.button:hover .fill-container::after {
transform: translateY(0);
}