AI CSS Animations

Neon Button

An outlined button that switches on like a neon sign: the text and border glow, and light bleeds inward. Meant for dark backgrounds.

Also known as: neon glow button, cyberpunk button.

HTML

<button class="hfx-neon">Enter</button>

CSS

.hfx-neon {
  --c: var(--hfx-color, #3b82f6);
  font-size: var(--hfx-size, 16px);
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.7em 1.6em;
  border-radius: 0.5em;
  font: 600 1em system-ui, sans-serif;
  cursor: pointer;
  border: 2px solid var(--c);
  background: transparent;
  color: var(--c);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: box-shadow 0.3s ease, text-shadow 0.3s ease, background-color 0.3s ease;}
.hfx-neon:hover {
  background: color-mix(in srgb, var(--c) 10%, transparent);
  text-shadow: 0 0 0.5em var(--c);
  box-shadow: 0 0 0.5em var(--c), 0 0 1.5em color-mix(in srgb, var(--c) 60%, transparent), inset 0 0 0.8em color-mix(in srgb, var(--c) 30%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .hfx-neon, .hfx-neon *, .hfx-neon::before, .hfx-neon::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --hfx-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --hfx-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 16px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar hover effects