پیشنمایش زنده
کد HTML
<button class="btn">
Get Berry
<span class="icon-circle" aria-hidden="true">
<svg
viewBox="0 0 8 12"
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
>
<path
d="M1 1l5 5-5 5"
stroke="white"
stroke-width="2"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
</span>
</button>
کد CSS
.btn {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
font-family: sans-serif;
font-weight: 600;
font-size: clamp(14px, 1rem, 22px);
color: #202020;
cursor: pointer;
padding: clamp(8px, 0.9rem, 14px) clamp(12px, 1.2rem, 20px)
clamp(8px, 0.9rem, 14px) clamp(20px, 2rem, 36px);
border-radius: 52px;
background: rgba(255, 255, 255, 0.3);
backdrop-filter: blur(167px);
-webkit-backdrop-filter: blur(167px);
border: none;
overflow: hidden;
z-index: 1;
transition: transform 0.2s ease;
white-space: nowrap;
}
.btn::before {
content: "";
position: absolute;
inset: 0;
padding: 2px;
border-radius: 52px;
background: linear-gradient(
to bottom,
#ffffff,
rgba(102, 102, 102, 0.66),
#ffffff
);
-webkit-mask:
linear-gradient(#fff 0 0) content-box,
linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
mask-composite: exclude;
z-index: -1;
}
.btn:focus::after {
content: "";
position: absolute;
inset: -30px;
border-radius: 80px;
background: linear-gradient(270deg, #ff6ec4, #7873f5, #00dbde, #ff6ec4);
background-size: 600% 600%;
z-index: -2;
filter: blur(50px);
animation: moveGradient 4s ease infinite;
}
@keyframes moveGradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.btn .icon-circle {
display: inline-flex;
align-items: center;
justify-content: center;
background-color: #202020;
border-radius: 50%;
width: clamp(36px, 2.8rem, 56px);
height: clamp(36px, 2.8rem, 56px);
margin-left: clamp(8px, 1rem, 16px);
transition: transform 0.2s ease;
}
.btn:hover .icon-circle {
animation: jelly 0.6s;
}
.btn .icon-circle svg {
fill: white;
width: clamp(12px, 1rem, 18px);
height: clamp(12px, 1rem, 18px);
}
.btn:focus .icon-circle {
background-color: #121212;
}
.btn:focus {
animation: jelly 0.6s;
}
@keyframes jelly {
0% {
transform: scale(1, 1);
}
25% {
transform: scale(1.2, 0.8);
}
50% {
transform: scale(0.9, 1.1);
}
75% {
transform: scale(1.05, 0.95);
}
100% {
transform: scale(1, 1);
}
}
@media (max-width: 480px) {
.btn {
font-size: 14px;
padding: 8px 14px 8px 20px;
}
}