JSFiddle - React, Tailwind, and code Playground
by HDL52
HTML
<div class="box">
<span></span>
</div>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
overflow: hidden;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #fff;
scale: 0.75;
}
@property --a {
syntax: "<angle>";
inherits: false;
initial-value: 0deg;
}
.box {
position: relative;
width: 400px;
height: 300px;
}
.box::before {
content: "";
position: absolute;
inset: 0;
background: repeating-conic-gradient(from var(--a), #0f0, #ff0, #0ff, #f0f, #0ff);
border-radius: 20px;
animation: rotating 4s linear infinite;
}
.box::after {
content: "";
position: absolute;
inset: 0;
background: repeating-conic-gradient(from var(--a), #0f0, #ff0, #0ff, #f0f, #0ff);
border-radius: 20px;
animation: rotating 4s linear infinite;
filter: blur(40px);
opacity: 0.75;
}
.box span{
position: absolute;
inset: 4px;
background: #222;
border-radius: 16px;
z-index: 1;
}
@keyframes rotating {
0% {
--a: 0deg;
}
100% {
--a: 360deg;
}
}