AI CSS Animations

Echo Text Hover Effect

Outlined copies of the word step out above and below it on hover, like a line repeated on a gig poster. Two stroked pseudo-element copies spring into place on transform.

Also known as: repeat text on hover, stacked outline text, text echo effect.

Louder

HTML

<div class="hfx-text-echo" data-text="Louder">Louder</div>

CSS

.hfx-text-echo {
  --c: var(--hfx-color, #3b82f6);
  font-size: calc(var(--hfx-size, 16px) * 2.2);
  font-family: system-ui, sans-serif;
  font-weight: 800;
  line-height: 1.15;
  cursor: default;
  position: relative;
  isolation: isolate;
  display: inline-block;
  font-family: "Arial Black", Arial, sans-serif;
  font-weight: 900;
  line-height: 1;
  transition: color 0.3s ease;}
.hfx-text-echo::before,
.hfx-text-echo::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 0.03em var(--c);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.hfx-text-echo:hover { color: var(--c); }
.hfx-text-echo:hover::before {
  opacity: 0.7;
  transform: translateY(-0.95em);
}
.hfx-text-echo:hover::after {
  opacity: 0.7;
  transform: translateY(0.95em);
}

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