AI CSS Animations

Brush Stroke Underline

A tapered brush swoosh paints itself under a word, heavy where the brush lands and thinning to a point. A filled SVG shape stretched to the word's width and uncovered with clip-path.

Also known as: paint brush underline css, hand drawn swoosh underline, tapered underline svg.

Made for makers

HTML

<div class="txt-brush-stroke-underline">Made for <span class="txt-brush-stroke-underline-word">makers<svg viewBox="0 0 200 24" preserveAspectRatio="none" aria-hidden="true"><path d="M3 14 C50 6, 130 2, 197 4 C130 9, 60 15, 12 21 Q2 22, 3 14 Z" /></svg></span></div>

CSS

.txt-brush-stroke-underline {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  isolation: isolate;
  white-space: nowrap;}
.txt-brush-stroke-underline-word {
  position: relative;
  display: inline-block;
}
.txt-brush-stroke-underline-word svg {
  position: absolute;
  z-index: -1;
  left: -0.08em;
  bottom: -0.22em;
  width: calc(100% + 0.2em);
  height: 0.42em;
  fill: var(--c);
  clip-path: inset(0 100% 0 0);
  animation: txt-brush-stroke-underline-paint 0.55s cubic-bezier(0.3, 0, 0.2, 1) 0.35s forwards;
}
@keyframes txt-brush-stroke-underline-paint {
  to { clip-path: inset(0 0 0 0); }
}

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