AI CSS Animations

Dripping Text Effect

Drops of paint slowly swell under the letters, stretch, and fall away, each letter on its own schedule. Every drop is a pseudo-element that scales from its top edge, then drops and fades.

Also known as: wet paint text, drip text animation css, melting text drips.

HTML

<div class="txt-dripping-text" aria-label="Wet paint"><span aria-hidden="true"><span style="--i: 0">W</span><span style="--i: 1">e</span><span style="--i: 2">t</span><span style="--i: 3">&nbsp;</span><span style="--i: 4">p</span><span style="--i: 5">a</span><span style="--i: 6">i</span><span style="--i: 7">n</span><span style="--i: 8">t</span></span></div>

CSS

.txt-dripping-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;
  color: var(--c);
  padding-bottom: 0.9em;}
.txt-dripping-text span span {
  position: relative;
  display: inline-block;
}
.txt-dripping-text span span::after {
  content: "";
  position: absolute;
  top: 0.88em;
  left: 50%;
  width: 0.17em;
  height: 0.22em;
  margin-left: -0.085em;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--c);
  transform-origin: 50% 0;
  animation: txt-dripping-text-drip 4s infinite;
  animation-delay: calc(var(--i) * -1.3s);
}
.txt-dripping-text span span:nth-child(3n)::after { animation-duration: 3.3s; }
@keyframes txt-dripping-text-drip {
  0%      { transform: translateY(0) scale(0.3, 0); opacity: 1; animation-timing-function: ease-in-out; }
  /* swell, stretch, let go */
  50%     { transform: translateY(0) scale(0.9, 1); animation-timing-function: ease-in; }
  62%     { transform: translateY(0.06em) scale(0.75, 1.35); animation-timing-function: cubic-bezier(0.5, 0, 1, 0.6); }
  78%     { transform: translateY(0.95em) scale(0.7, 1.2); opacity: 1; animation-timing-function: linear; }
  84%, 100% { transform: translateY(1.1em) scale(0.6, 1); opacity: 0; }
}

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