Rotating Gradient Border
A copy-paste borders & outlines component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Borders & OutlinesHTMLCSSany framework
Rotating Gradient
Copy into your project
HTML
<div class="nuda-bdx-rot-grad">
<span class="nuda-bdx-rot-grad__inner">Rotating Gradient</span>
</div>CSS
.nuda-bdx-rot-grad {
position: relative;
display: inline-flex;
border-radius: 14px;
padding: 2px;
background: conic-gradient(from var(--nuda-bdx-rg-angle,0deg),#e4ff54,#00d4ff,#ff6b6b,#a855f7,#e4ff54);
animation: _nuda-bdxRotGrad 3s linear infinite;
}
.nuda-bdx-rot-grad__inner {
display: block;
background: #141414;
border-radius: 12px;
padding: 18px 32px;
color: #fafafa;
font-size: .85rem;
font-weight: 500;
letter-spacing: .02em;
white-space: nowrap;
}
@property --nuda-bdx-rg-angle {
syntax: "<angle>";
initial-value: 0deg;
inherits: false;
}
@keyframes _nuda-bdxRotGrad {
to {
--nuda-bdx-rg-angle: 360deg;
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-bdx-rot-grad {
animation: none;
}
}
How to use Rotating Gradient Border
Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.
Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.