AI CSS Animations

Pulse CTA Button

A call to action that sends soft rings out from its edge on a steady rhythm, to pull the eye without a hover. Two pseudo-elements take turns scaling and fading behind the button.

Also known as: css button pulse animation, pulse animation css button, attention button css.

HTML

<button class="btn-pulse-cta" type="button">Book a demo</button>

CSS

.btn-pulse-cta {
  --c: var(--btn-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.75em 1.6em;
  border: 0;
  border-radius: 0.6em;
  font: 600 var(--btn-size, 18px)/1.1 system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  isolation: isolate;
  padding: 0.85em 1.9em;
  border-radius: 2em;
  background: var(--c);
  color: #fff;
  transition: transform 0.2s ease;}
.btn-pulse-cta::before,
.btn-pulse-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--c);
  opacity: 0;
  animation: btn-pulse-cta-ring 2.4s cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
  pointer-events: none;
}
.btn-pulse-cta::after { animation-delay: 1.2s; }
.btn-pulse-cta:active { transform: scale(0.96); }
@keyframes btn-pulse-cta-ring {
  0%   { opacity: 0.45; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.22, 1.75); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-pulse-cta, .btn-pulse-cta *, .btn-pulse-cta::before, .btn-pulse-cta::after, .btn-pulse-cta *::before, .btn-pulse-cta *::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.

<button class="relative isolate rounded-full bg-blue-500 px-7 py-3 font-semibold text-white active:scale-95">
  <span class="absolute inset-0 -z-10 animate-ping rounded-full bg-blue-500 opacity-40"></span>
  Book a demo
</button>

Customizing this snippet

  • Color: set --btn-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --btn-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 18px.
  • 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 buttons