AI CSS Animations

Holographic Foil Text

Rainbow foil bands and a white glare slide across the letters at different speeds, like tilting a holographic sticker. Two layers on one alternating animation give the parallax.

Also known as: holo foil text css, holographic sticker text, rainbow foil text effect.

Holographic

HTML

<div class="txt-holographic-foil-text">Holographic</div>

CSS

.txt-holographic-foil-text {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  font-weight: 800;
  background:
    linear-gradient(115deg, transparent 30%, rgb(255 255 255 / 0.7) 47%, transparent 62%) 0 0 / 300% 100%,
    repeating-linear-gradient(115deg, #f472b6 0em, #facc15 0.55em, #4ade80 1.1em, #38bdf8 1.65em, #a78bfa 2.2em, #f472b6 2.75em) 0 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: max(1px, 0.012em) color-mix(in srgb, color-mix(in srgb, var(--c) 50%, #4c1d95) 60%, transparent);
  animation: txt-holographic-foil-text-tilt 3s ease-in-out infinite alternate;}
@keyframes txt-holographic-foil-text-tilt {
  from { background-position: 0% 0, 0% 0; }
  to   { background-position: 100% 0, 45% 0; }
}

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

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • 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 text animations