CSS Animation Example: The Pulse

"The Pulse" is a soft, radiating glow effect commonly used for Call-to-Action (CTA) buttons to draw the user's eye.

This effect is achieved by animating the transform and box-shadow properties using @keyframes. Over the course of the animation, the button scales up slightly, while a colored shadow expands outward and fades away.

Here is the code to create the Pulse animation.

View Output

Accessibility Considerations

Animations that draw attention can be distracting or even problematic for users with vestibular disorders. It's a best practice to respect the user's system preferences regarding motion. You can use the prefers-reduced-motion media query to detect if the user has requested that the system minimize the amount of non-essential motion it uses. Users generally set this preference via their operating system settings or a browser extension, and you can mimic this setting for testing purposes via your browser's Developer Tools.

Here we completely disable the animation for those users.


@media (prefers-reduced-motion: reduce) {
    .pulse-button {
        animation: none;
    }
}