AI CSS Animations

Pastel Rainbow Text

Six pastel bands rise through chunky letters like a scrolling rainbow flag, with a dusky drop shadow so the pale colors still read on white. The band stack is one tile that loops.

Also known as: pastel gradient text, rainbow stripe text css, soft rainbow text.

Sweet Dreams

HTML

<div class="txt-pastel-rainbow-text">Sweet Dreams</div>

CSS

.txt-pastel-rainbow-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: 900;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg,
    #f9a8d4 0 16.66%, #fdba74 0 33.33%, #fde047 0 50%, #86efac 0 66.66%, #7dd3fc 0 83.33%, #c4b5fd 0) 0 0 / 100% 1.2em;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0.06em 0 color-mix(in srgb, var(--c) 35%, #3b0764));
  animation: txt-pastel-rainbow-text-rise 2.4s linear infinite;}
@keyframes txt-pastel-rainbow-text-rise {
  to { background-position: 0 -1.2em; }
}

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