Skip to content

Rainbow Border

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

Borders & OutlinesHTMLCSSany framework
Rainbow Border

Copy into your project

HTML
<div class="nuda-rainbow-border">
  Your content here
</div>
CSS
/* Rainbow Border
   Rainbow color cycling border.
   Customize: gradient colors */

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

.nuda-rainbow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    #ef4444, #f59e0b, #22c55e,
    #06b6d4, #6366f1, #ec4899,
    #ef4444
  );
  background-size: 300% 100%;
  z-index: -1;
  animation: nuda-rainbow-shift 4s linear infinite;
  will-change: background-position;
}

@keyframes nuda-rainbow-shift {
  to { background-position: 300% 0; }
}

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

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