CSS Tutorial Web Development

CSS Pulse Animation

CSS Pulse Animation
by Marko Denic | February 26, 2025

In this article I will show you how to create a nice pulsing effect. I will also cover the use cases and also how to make it more performant.

Let’s start!

HTML element

First, we need one HTML element. Let’s give it a class .pulse. It can be an empty div as we don’t need any content here, at least not for this basic example.

           
<div class="pulse"></div>           
    

Circle

Now, we need some styles to make this element look like a circle.

           
.pulse {
    background: rgb(222, 84, 72);
    border-radius: 50%;
    height: 30px;
    width: 30px;
}           
    

Animation

Next, we will create this animation utilizing box-shadow and transform properties.

The box-shadow property adds a shadow around elements. The transform property lets you rotate, scale, skew, or translate an element.

           
.pulse {
    background: rgb(222, 84, 72);
    border-radius: 50%;
    height: 30px;
    width: 30px;
    box-shadow: 0 0 0 0 rgba(222, 84, 72, 1);
    transform: scale(1);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(222, 84, 72, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 15px rgba(222, 84, 72, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(222, 84, 72, 0);
    }
}           
    

This will already work, but let’s make it a more real-life example by making it a bit more dynamic.

For this purpose, I will rewrite the previous demo and use CSS variables to make it reusable. I will create 4 elements with different colors.

Let’s see what it looks like:

HTML CSS Preview

This is it, but I’ll provide one more example for you. Let’s create a “play” button you can use to create a CTA if you have some videos on your website.

In this example, we’ll need a bit more HTML and CSS, but I promise it’ll be fun. 🙂

HTML CSS Preview

Further reading: CSS Pulse Animation

Did you like this article? Share it with your friends:

Related articles

How to Build and Deploy a Laravel App to Sevalla

How to Build and Deploy a Laravel App to Sevalla

In this tutorial, we will see how to build a simple Laravel Application and deploy it to the cloud using Sevalla.

Introduction to CSS if Statements and Conditional Logic

Introduction to CSS if Statements and Conditional Logic

Conditional logic is a familiar concept to anyone who has written a programming language. Languages like JavaScript or Python use if/else statements to evaluate expressions and execute different blocks of code depending on whether the condition is true or false.

Install Mistral AI on Linux

Install Mistral AI on Linux

Learn to install Mistral AI on Linux with this step-by-step guide. Ideal for beginners and advanced users.