AI CSS Animations

Pulse Text

The text swells and relaxes on a slow beat. A single scale keyframe; use it on a call to action you want people to notice without moving anything across the screen.

Also known as: heartbeat text, throbbing text, scale pulse.

Limited offer

HTML

<div class="txt-pulse-scale">Limited offer</div>

CSS

.txt-pulse-scale {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  display: inline-block;
  color: var(--c);
  animation: txt-pulse-scale-beat 2s ease-in-out infinite;}
@keyframes txt-pulse-scale-beat {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-pulse-scale, .txt-pulse-scale *, .txt-pulse-scale::before, .txt-pulse-scale::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Tailwind CSS version

The same effect using Tailwind utility classes. No custom CSS or config needed.

<div class="animate-pulse text-4xl font-bold text-blue-500">Limited offer</div>

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