Skip to content
Knsept
Free playbook

Spotlight card

A card with a soft glow that follows the cursor. Two CSS variables and one set of listeners.

CSSUI Widgets Updated Sep 22, 2026
Live demo Reduced motion is on, so effects are toned down
<div class="spot">
  <h3>Spotlight card</h3>
  <p>Move your cursor across me, or press and drag on a touch screen.</p>
</div>

The fill glow is a radial gradient on ::before. The border glow on ::after uses the mask-composite trick to paint only a 1px ring, so the edge lights up nearest the cursor.

The script only writes --x, --y and a lit class. Using a class instead of :hover matters on phones, where :hover sticks after a tap.

More from the library

Cards & surfaces live

3D tilt card

A card that tilts toward the pointer in 3D, with its contents floating above the surface. Drag on touch; a smaller tilt with reduced motion.

Navigation live

Smooth accordion

A FAQ accordion built on native details/summary, with a smooth open and close animation and an optional one-open-at-a-time mode.

Scroll & motion live

Count-up stats

Numbers that count up when they scroll into view, with easing and formatting. A quicker count with reduced motion.