AI CSS Animations

VHS Glitch Text Effect

An on-screen VCR label with red and blue chroma bleed, a nervous horizontal wobble and a noisy tracking band that rolls through it. Monospace text; the play icon is one clipped span.

Also known as: vhs text effect css, vcr text effect, retro tape text.

PLAY

HTML

<div class="txt-vhs-glitch-text"><span class="txt-vhs-glitch-text-icon" aria-hidden="true"></span>PLAY</div>

CSS

.txt-vhs-glitch-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;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.5em;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  color: var(--c);
  text-shadow: -0.06em 0 rgb(255 0 90 / 0.7), 0.06em 0 rgb(0 170 255 / 0.7);
  animation: txt-vhs-glitch-text-wobble 3.4s steps(1, end) infinite;}
.txt-vhs-glitch-text-icon {
  filter: drop-shadow(-0.06em 0 rgb(255 0 90 / 0.7)) drop-shadow(0.06em 0 rgb(0 170 255 / 0.7));
}
.txt-vhs-glitch-text-icon::before {
  content: "";
  display: block;
  width: 0.62em;
  height: 0.72em;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
/* the tracking band: noise lines that soften whatever they pass over */
.txt-vhs-glitch-text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0.32em;
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--c) 50%, transparent) 0 0.08em, transparent 0.08em 0.2em, color-mix(in srgb, var(--c) 25%, transparent) 0.2em 0.26em, transparent 0.26em 0.5em);
  -webkit-backdrop-filter: blur(0.03em);
  backdrop-filter: blur(0.03em);
  transform: translateY(-0.4em);
  animation: txt-vhs-glitch-text-track 3.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes txt-vhs-glitch-text-track {
  0%, 38% { transform: translateY(-0.4em); }
  78%, 100% { transform: translateY(1.8em); }
}
@keyframes txt-vhs-glitch-text-wobble {
  0%, 34%, 66%, 100% { transform: none; }
  12% { transform: translateX(0.02em); }
  20% { transform: translateX(-0.015em); }
  52% { transform: translateX(0.05em) skewX(-5deg); text-shadow: -0.12em 0 rgb(255 0 90 / 0.7), 0.1em 0 rgb(0 170 255 / 0.7); }
  55% { transform: translateX(-0.03em); }
  58% { transform: translateX(0.02em) skewX(3deg); }
  61% { transform: none; text-shadow: -0.06em 0 rgb(255 0 90 / 0.7), 0.06em 0 rgb(0 170 255 / 0.7); }
  84% { transform: translateX(0.015em); }
}

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