/* Reset default browser padding, margin and set consistent box model */
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
/* Center content on the page with flexbox */
body {
display: flex;
justify-content: center;
align-items: center;
background: #06064d;
height: 100vh;
}
/* Create a custom CSS property that smoothly animates angles */
@property --angle {
syntax: "";
/* Type of value */
initial-value: 0deg;
/* Start angle for animation */
inherits: false;
}
/* Main button container */
.btn {
position: relative;
width: 200px;
padding: 3px;
border: 0;
outline: none;
cursor: pointer;
border-radius: 12px;
background: #120909;
overflow: hidden;
/* Hide gradient overflow */
}
/* Animated conic border created using ::before pseudo-element */
.btn::before {
content: "";
position: absolute;
background: conic-gradient(from var(--angle), cyan, hotpink, #341f97, cyan);
opacity: 0;
/* Hidden at first */
transition: opacity .3s ease;
inset: 0;
/* Stretch to full button area */
animation: rotate 2s linear infinite;
/* Rotating gradient */
}
/* Inner text area of button */
.text {
position: relative;
background: #000;
z-index: 1;
text-align: center;
font-weight: 600;
letter-spacing: 1.5px;
font-size: 1rem;
font-family: system-ui;
color: #e8e8e8;
padding: 1rem;
border-radius: 10px;
text-transform: uppercase;
}
/* Show glowing conic border on hover */
.btn:hover::before {
opacity: 1;
}
/* Animation of the custom angle property */
@keyframes rotate {
to {
--angle: 360deg;
}
}