Skip to content

Gradient Border

A copy-paste borders & outlines component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Borders & OutlinesHTMLCSSany framework
Gradient Border

Copy into your project

HTML
<div class="nuda-gradient-border">
  Your content here
</div>
CSS
/* Gradient Border
   Animated rotating gradient border using @property.
   Customize: gradient colors */

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

.nuda-gradient-border {
  position: relative;
  background: #111;
  border-radius: 12px;
  padding: 24px 32px;
  isolation: isolate;
}

.nuda-gradient-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(
    from var(--nuda-gb-angle),
    #6366f1, #ec4899, #f59e0b,
    #22c55e, #06b6d4, #6366f1
  );
  z-index: -1;
  animation: nuda-gradient-rotate 3s linear infinite;
  will-change: --nuda-gb-angle;
}

@keyframes nuda-gradient-rotate {
  to { --nuda-gb-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .nuda-gradient-border::before { animation: none; }
}

How to use 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