AI CSS Animations

Shine Text Hover Effect

A bright glint passes through the letters once on hover, like light catching foil. The text is a wide gradient clipped to the glyphs, and hovering slides its background-position.

Also known as: shimmer text on hover, glint sweep text, light reflection text.

Premium

HTML

<div class="hfx-text-shine">Premium</div>

CSS

.hfx-text-shine {
  --c: var(--hfx-color, #3b82f6);
  font-size: calc(var(--hfx-size, 16px) * 2.5);
  font-family: system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.15;
  cursor: default;
  display: inline-block;
  -webkit-text-fill-color: transparent;
  background: linear-gradient(110deg, var(--c) 44%, color-mix(in srgb, var(--c) 35%, #fff) 50%, var(--c) 56%)
    100% 0 / 250% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  transition: background-position 0.9s cubic-bezier(0.4, 0, 0.2, 1);}
.hfx-text-shine:hover { background-position: 0 0; }

@media (prefers-reduced-motion: reduce) {
  .hfx-text-shine, .hfx-text-shine *, .hfx-text-shine::before, .hfx-text-shine::after, .hfx-text-shine *::before, .hfx-text-shine *::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