پیشنمایش زنده
کد HTML
<button class="secondary-button">
Secondary button
</button>
کد CSS
/* <reset-style> ============================ */
button {
border: none;
background: none;
padding: 0;
margin: 0;
cursor: pointer;
font-family: inherit;
}
/* <main-style> ============================ */
.secondary-button {
min-width: 111px;
height: 52px;
border-radius: 36px;
background: #fff;
padding: 16px 40px;
display: flex;
justify-content: center;
align-items: center;
color: #000;
font-size: 16px;
font-weight: 400;
line-height: 1.5;
letter-spacing: -0.32px;
transition: color .2s ease-in-out;
position: relative;
}
.secondary-button::before,
.secondary-button::after {
content: '';
width: calc(100% + 4px);
height: calc(100% + 4px);
border-radius: 40px;
position: absolute;
top: 50%;
left: 50%;
z-index: -1;
transform: translate(-50%, -50%);
}
.secondary-button::before {
background: linear-gradient(88deg, #c3aab2 0.66%, #9ec 57.2%, #80c0c8 75.87%, #4b8bfa 98.72%);
opacity: 0;
transition: opacity .2s ease-in-out;
}
.secondary-button::after {
background: #000;
transition: opacity .2s ease-in-out;
}
.secondary-button:hover::before {
opacity: 1;
}
.secondary-button:hover::after {
opacity: 0;
}