AI CSS Animations

Synthwave Retro Text

An 80s chrome title with a pink glow over a neon grid that scrolls toward you. The grid is two gradient layers on a pseudo-element tilted with perspective; only its background moves.

Also known as: 80s retro text effect, outrun text css, retrowave title.

NIGHT DRIVE

HTML

<div class="txt-synthwave-text"><span class="txt-synthwave-text-title">NIGHT DRIVE</span></div>

CSS

.txt-synthwave-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-block;
  padding: 0 0.3em 1.2em;
  font-style: italic;
  font-weight: 900;
  letter-spacing: 0.02em;}
.txt-synthwave-text::before {
  content: "";
  position: absolute;
  left: -1.5em;
  right: -1.5em;
  bottom: 0;
  height: 1.5em;
  background-image:
    linear-gradient(180deg, #ff3ea5 0.05em, transparent 0.05em),
    linear-gradient(90deg, #ff3ea5 0.05em, transparent 0.05em);
  background-size: 100% 0.4em, 0.8em 100%;
  background-position: 0 0, 50% 0;
  transform: perspective(4em) rotateX(58deg);
  transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 45%);
  mask-image: linear-gradient(180deg, transparent, #000 45%);
  animation: txt-synthwave-text-drive 0.7s linear infinite;
}
.txt-synthwave-text::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1.3em;
  width: 3.2em;
  height: 1.6em;
  border-radius: 1.6em 1.6em 0 0;
  background: linear-gradient(180deg, #ffd23f, #ff3ea5);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 55% 62%, #000 62% 74%, transparent 74% 80%, #000 80% 88%, transparent 88%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 55% 62%, #000 62% 74%, transparent 74% 80%, #000 80% 88%, transparent 88%);
  transform: translateX(-50%);
  opacity: 0.75;
}
.txt-synthwave-text-title {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--c) 35%, #fff) 0%,
    var(--c) 46%,
    color-mix(in srgb, var(--c) 55%, #000) 50%,
    #ff3ea5 54%,
    color-mix(in srgb, #ff3ea5 45%, #fff) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.015em color-mix(in srgb, var(--c) 60%, #000);
  filter: drop-shadow(0 0 0.1em color-mix(in srgb, #ff3ea5 70%, transparent));
}
@keyframes txt-synthwave-text-drive {
  to { background-position: 0 0.4em, 50% 0; }
}

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