StealThis .dev

Border Beam

A card with an animated beam of light that travels continuously around its border using conic-gradient and CSS keyframes.

Open in Lab
css javascript vue svelte
Targets: TS JS HTML React Vue Svelte

Code

Border Beam

A card/container with an animated beam of light that travels around its border continuously. The effect is achieved using a rotating conic-gradient behind the card with overflow hidden to reveal only the border region.

How it works

  1. A pseudo-element with a conic-gradient is positioned behind the card content
  2. The gradient has a narrow bright segment that acts as the “beam”
  3. A @keyframes animation rotates the pseudo-element 360 degrees continuously
  4. The inner content area masks the center, revealing only the glowing border

Customization

  • Change beam color via --beam-color (default: cyan/blue)
  • Adjust speed with --beam-speed (default: 4s)
  • Modify border width by adjusting the inner content inset

When to use it

  • Feature cards that need visual emphasis
  • Pricing cards or highlighted sections
  • Interactive dashboard widgets