<a class="button-48" href="#"><span class="button-48__inner">ボタン48</span></a>
a.button-48(href=link)
span.button-48__inner #{ text }
{
"link": "#",
"text": "ボタン48"
}
$BLOCK_NAME: '.button-48';
// 変数
// https://developer.mozilla.org/ja/docs/Web/CSS/@property
@property --angle {
syntax: '<angle>';
inherits: false;
initial-value: 0deg;
}
#{ $BLOCK_NAME } {
position: relative;
display: block;
width: 320px;
height: 64px;
padding: 4px;
border-radius: 9999px;
background: #222;
&::before {
position: absolute;
inset: 0;
display: block;
content: '';
border-radius: 9999px;
z-index: 1;
opacity: 0;
background: conic-gradient(
from var(--angle),
#222,
#939393,
#222,
#939393,
#222
);
}
&__inner {
position: relative;
display: flex;
width: 100%;
height: 100%;
align-items: center;
justify-content: center;
background: #fff;
border-radius: 9999px;
z-index: 2;
}
@media (any-hover: hover) {
&::before {
transition: opacity 0.3s;
}
&:hover::before {
opacity: 1;
animation: gradient-spin 3s linear 0s infinite;
}
}
}
@keyframes gradient-spin {
0% {
--angle: 0deg;
}
100% {
--angle: 360deg;
}
}