Skip to content

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-rgb-border">
  <span class="nuda-rgb-border__inner">Rotating Gradient</span>
</div>
CSS
.nuda-rgb-border {
  position: relative;
  display: inline-flex;
  border-radius: 14px;
  padding: 2px;
  background: conic-gradient(from var(--nuda-rgb-angle,0deg),#e4ff54,#62b6ff,#9d6dff,#e4ff54);
  animation: _nuda-rgbSpin 4s linear infinite;
}

.nuda-rgb-border__inner {
  display: block;
  background: #09090b;
  border-radius: 12px;
  padding: 18px 32px;
  color: #fafafa;
  font-size: .85rem;
  font-weight: 500;
  letter-spacing: .02em;
  white-space: nowrap;
}

@property --nuda-rgb-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@keyframes _nuda-rgbSpin {
  to {
    --nuda-rgb-angle: 360deg;
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-rgb-border {
    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.

More borders & outlines components

← Browse all NudaUI components