پیشنمایش زنده
کد HTML
<button class="button">
<span class="icon">
<svg
fill="currentColor"
height="20"
width="20"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
clip-rule="evenodd"
d="M9 4.5a.75.75 0 0 1 .721.544l.813 2.846a3.75 3.75 0 0 0 2.576 2.576l2.846.813a.75.75 0 0 1 0 1.442l-2.846.813a3.75 3.75 0 0 0-2.576 2.576l-.813 2.846a.75.75 0 0 1-1.442 0l-.813-2.846a3.75 3.75 0 0 0-2.576-2.576l-2.846-.813a.75.75 0 0 1 0-1.442l2.846-.813A3.75 3.75 0 0 0 7.466 7.89l.813-2.846A.75.75 0 0 1 9 4.5ZM18 1.5a.75.75 0 0 1 .728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 0 1 0 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 0 1-1.456 0l-.258-1.036a2.625 2.625 0 0 0-1.91-1.91l-1.036-.258a.75.75 0 0 1 0-1.456l1.036-.258a2.625 2.625 0 0 0 1.91-1.91l.258-1.036A.75.75 0 0 1 18 1.5ZM16.5 15a.75.75 0 0 1 .712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 0 1 0 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 0 1-1.422 0l-.395-1.183a1.5 1.5 0 0 0-.948-.948l-1.183-.395a.75.75 0 0 1 0-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0 1 16.5 15Z"
fill-rule="evenodd"
></path>
</svg>
</span>
Generating
</button>
کد CSS
.button {
outline: 1px solid #afafaf88;
outline-offset: 4px;
border: 1px solid #afafaf77;
background: #fff;
display: flex;
align-items: center;
gap: 0.5em;
cursor: pointer;
padding: 0.5em 1em;
border-radius: 32px;
position: relative;
.icon {
color: #4935ea;
}
&::before {
--border-angle: 0turn;
--main-bg: conic-gradient(from var(--border-angle), #e8e8e8, #e8e8e8);
--gradient-border: conic-gradient(
from var(--border-angle),
transparent 80%,
#4935ea 85%,
#08f 95%,
transparent
);
content: "";
position: absolute;
inset: -3.5px;
border-radius: inherit;
border: 2px solid transparent;
background:
var(--main-bg) padding-box,
var(--gradient-border) border-box,
var(--main-bg) border-box;
z-index: -1;
animation: bg-spin 3s linear infinite;
}
}
.button:hover {
box-shadow: 0 0 8px 1px #afafaf22;
}
.button:active {
box-shadow: inset 0 0 2px 1px #afafaf22;
}
@keyframes bg-spin {
to {
--border-angle: 1turn;
}
}