15 CSS Glowing Border Buttons01 / 15

Pure CSSMIT licensed

Rotating Rainbow Gradient Glowing Border Button

The definitive dark-theme SaaS primary CTA: a full-spectrum conic-gradient ring orbits the button forever, with a blurred twin of the same gradient breathing underneath as the glow. Built on @property so the rotation is a real, hardware-cheap CSS animation — zero JavaScript, zero libraries.

Published

Live Demo
Try it

The code

<section class="gbb-01" aria-label="Rotating rainbow gradient border button demo">
  <button class="gbb-01__btn" type="button">Get Started Free</button>
</section>
.gbb-01,
.gbb-01 *,
.gbb-01 *::before,
.gbb-01 *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@property --gbb-a {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.gbb-01 {
  font-family: 'Segoe UI',system-ui,sans-serif;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: radial-gradient(70% 90% at 50% 0%,oklch(0.22 0.05 290 / .8),transparent 65%),oklch(0.13 0.02 280);
}

.gbb-01 .gbb-01__btn {
  position: relative;
  isolation: isolate;
  border: none;
  cursor: pointer;
  padding: 16px 34px;
  border-radius: 999px;
  font: 600 16px/1 'Segoe UI',system-ui,sans-serif;
  letter-spacing: .01em;
  color: #fff;
  background: oklch(0.17 0.02 280);
  transition: transform .25s ease;
}

.gbb-01 .gbb-01__btn::before,
.gbb-01 .gbb-01__btn::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--gbb-a),oklch(0.72 0.2 20),oklch(0.8 0.17 90),oklch(0.75 0.16 160),oklch(0.7 0.15 230),oklch(0.65 0.22 300),oklch(0.72 0.2 20));
  animation: gbb01-spin 3.5s linear infinite;
}

.gbb-01 .gbb-01__btn::after {
  filter: blur(18px);
  opacity: .55;
  transition: opacity .35s ease;
}

.gbb-01 .gbb-01__btn:hover,
.gbb-01 .gbb-01__btn:focus-visible {
  transform: translateY(-2px);
}

.gbb-01 .gbb-01__btn:hover::before,
.gbb-01 .gbb-01__btn:hover::after {
  animation-duration: 1.4s;
}

.gbb-01 .gbb-01__btn:hover::after {
  opacity: .95;
}

.gbb-01 .gbb-01__btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 5px;
}

.gbb-01 .gbb-01__btn:active {
  transform: translateY(0) scale(.98);
}

@keyframes gbb01-spin {
  to {
    --gbb-a: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gbb-01 .gbb-01__btn::before,
    .gbb-01 .gbb-01__btn::after {
    animation: none;
  }
}
/* No JavaScript — @property makes --gbb-a a typed, animatable angle, so the conic-gradient ring rotates with a plain @keyframes loop. */
Paste this into ChatGPT, Claude, Cursor, or any coding assistant. The block below is pre-framed with everything the AI needs to integrate this demo into your project — markup, styles, scoping notes, and the source URL. Hit Copy and paste straight into your chat.
Here's a working CSS Glowing Border Button from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Rotating Rainbow Gradient Glowing Border Button
Source: https://codefronts.com/components/css-glowing-border-buttons/rotating-rainbow-gradient-glowing-border-button/

The definitive dark-theme SaaS primary CTA: a full-spectrum conic-gradient ring orbits the button forever, with a blurred twin of the same gradient breathing underneath as the glow. Built on @property so the rotation is a real, hardware-cheap CSS animation — zero JavaScript, zero libraries.
## HTML
```html
<section class="gbb-01" aria-label="Rotating rainbow gradient border button demo">
  <button class="gbb-01__btn" type="button">Get Started Free</button>
</section>
```
## CSS
```css
.gbb-01,
.gbb-01 *,
.gbb-01 *::before,
.gbb-01 *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@property --gbb-a {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.gbb-01 {
  font-family: 'Segoe UI',system-ui,sans-serif;
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 24px;
  background: radial-gradient(70% 90% at 50% 0%,oklch(0.22 0.05 290 / .8),transparent 65%),oklch(0.13 0.02 280);
}

.gbb-01 .gbb-01__btn {
  position: relative;
  isolation: isolate;
  border: none;
  cursor: pointer;
  padding: 16px 34px;
  border-radius: 999px;
  font: 600 16px/1 'Segoe UI',system-ui,sans-serif;
  letter-spacing: .01em;
  color: #fff;
  background: oklch(0.17 0.02 280);
  transition: transform .25s ease;
}

.gbb-01 .gbb-01__btn::before,
.gbb-01 .gbb-01__btn::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: inherit;
  background: conic-gradient(from var(--gbb-a),oklch(0.72 0.2 20),oklch(0.8 0.17 90),oklch(0.75 0.16 160),oklch(0.7 0.15 230),oklch(0.65 0.22 300),oklch(0.72 0.2 20));
  animation: gbb01-spin 3.5s linear infinite;
}

.gbb-01 .gbb-01__btn::after {
  filter: blur(18px);
  opacity: .55;
  transition: opacity .35s ease;
}

.gbb-01 .gbb-01__btn:hover,
.gbb-01 .gbb-01__btn:focus-visible {
  transform: translateY(-2px);
}

.gbb-01 .gbb-01__btn:hover::before,
.gbb-01 .gbb-01__btn:hover::after {
  animation-duration: 1.4s;
}

.gbb-01 .gbb-01__btn:hover::after {
  opacity: .95;
}

.gbb-01 .gbb-01__btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 5px;
}

.gbb-01 .gbb-01__btn:active {
  transform: translateY(0) scale(.98);
}

@keyframes gbb01-spin {
  to {
    --gbb-a: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gbb-01 .gbb-01__btn::before,
    .gbb-01 .gbb-01__btn::after {
    animation: none;
  }
}
```

## JavaScript
```js
/* No JavaScript — @property makes --gbb-a a typed, animatable angle, so the conic-gradient ring rotates with a plain @keyframes loop. */
```

How this works

The whole effect is one registered custom property. @property --gbb-a { syntax:'<angle>' } tells the engine the variable is an angle, which makes it animatable — so conic-gradient(from var(--gbb-a), …) can spin via a plain @keyframes loop. Without the registration the browser treats the variable as an opaque string and snaps instead of tweening; that one line is the entire trick.

Two stacked pseudo-elements share the gradient: ::before sits 2px proud of the button (inset:-2px) and reads as the border ring, while ::after is the same gradient with filter:blur(18px) — the halo. The button's own solid background covers the middle, so no masking is needed. On hover the halo's opacity lifts from .55 to .95 and the spin speeds up: instant "this is the button" focus on a pricing page.

Make it yours

  • Rebrand the rainbow by editing the conic stops — two brand hues + white produces a premium 'shimmer ring' instead of the full spectrum.
  • Speed: 4s reads calm/enterprise, 1.5s reads energetic/gaming. Hover speed is a separate declaration — tune independently.
  • Ring thickness is just the inset on ::before: -2px hairline, -4px statement piece.
  • Make it a quiet-until-hover button by starting ::after at opacity 0.

Gotchas — read before shipping

  • Forgetting @property is the #1 failure: the gradient jumps once per loop instead of rotating smoothly.
  • The button needs a solid (non-transparent) background or the gradient shows through the middle.
  • Both pseudo-elements must be z-index:-1 with the button on its own stacking context (isolation:isolate) — otherwise the blur paints over the label.

Browser support

ChromeSafariFirefoxEdge
111+16.4+128+111+

Floor set by oklch(), @property as this demo is written. The core technique itself goes back further — Chrome 85+.

@property is the gate. Engines without it show a static (non-rotating) gradient ring — a perfectly acceptable fallback.

Techniques used in this demo

Search CodeFronts

Loading…