How to Create Pulse Animation Using CSS (Code + Demo)
Foolish DeveloperJune 22, 2022
CSS Pulse Animation We see it in different places on web pages. Pulse Animation is used to make different UI elements interesting.
Here we will discuss how a Pulse Animation can be created using CSS. Here I have shared different types of designs such as Simple Pulse Animation CSS, button pulse animation, text pulse animation, image pulse animation, pulse animation on hover, etc.
Here I will use only CSS and HTML. I have shared here the complete information of each design, source code, and live demo of everything.
Examples - 1
Simple Pulse Animation CSS
This is a simple Pulse Animation design created by HTML and CSS only. This design is basically a basic example of Pulse Animation.
There is a small round point here that will continue to be the center of animation.
Hopefully, with the help of the demo button above, you know how it works. If you want you can download all the code using the button below.
But below I have given all the HTML CSS code. The code used for this CSS Pulse Animation effect is very simple so you will not have any difficulty understanding it.
The following code is the HTML code that helps to add the basic information of this pulsing animation. Here I have put together all the HTML codes that you can copy and paste into your HTML file.
<!DOCTYPEhtml>
<!--Simple Pulse Animation-->
<htmllang="en">
<head>
<!--CSS file-->
<linkrel="stylesheet"href="style.css">
</head>
<body>
<divclass="relative">
<button></button>
<divclass="span"></div>
<divclass="span"></div>
</div>
</body>
</html>
The following code is the CSS code that activates this pulsing animation. Copy these and paste them into your CSS file. Remember to rename your CSS file to 'style.css'.
First I created a button that added some color-changing animations. This means that the background color of the button will change under normal conditions. Then the pulse animation effect has been added.
I have added all the basic information using the following codes. Here only one line of HTML is used to create the button only.
<!DOCTYPEhtml>
<htmllang="en">
<head>
<!--CSS file-->
<linkrel="stylesheet"href="style.css">
</head>
<body>
<buttonclass="pulse-button">Auto-Pulse</button>
</body>
</html>
Now you have to add pulse animation to the button with the following CSS. Copy the following codes and add them to your CSS file.
If for some reason the above codes do not work then you can take the help of the download button above.
Examples - 3
Text pulse animation CSS
Now we will learn how to add pulse animation to text. Because in many places we use animation in the text. There are several ways to animate text. However, CSS text pulse animation is also used in many places.
It is made in a very simple way. Only a few lines of CSS have been used to create this text pulse animation.
If you want to know how this CSS pulse animation works then you can see the demo above. Here you will find all the source code. First I added text using one-line HTML. Then designed here using CSS.
Three-second animation is used here. The text can be seen when the animation starts. In the middle, that is, for some time after 1.5 seconds, the optical of the text will be zero, so I will not be able to see the text.
All the information has been added to create a text pulse animation using the following HTML codes. Copy the codes below and add them to your HTML file.
<!DOCTYPEhtml>
<htmllang="en">
<head>
<!--CSS file-->
<linkrel="stylesheet"href="style.css">
</head>
<body>
<h1class="element">Some example text</h1>
</body>
</html>
Now is the time to implement this pulse animation with some amount of CSS. Copy these codes and add them to your CSS file.
html,
body {
height: 100%;
text-align: center;
margin: 50pxauto;
font-family: sans-serif;
}
.element {
width: 100%;
height: 100%;
animation: pulse 3sinfinite;
}
@keyframespulse {
0% {
color: #0682f5;
}
50%{
opacity: 0;
}
100% {
color: #0682f5;
}
}
Examples - 4
Image pulse animation CSS
Now you know how to create image pulse animation using CSS. Above we have added this pulse animation in the text, in the button. Now I will add this simple pulse animation in a simple image.
There are many ways to make an image attractive. The hover effect is one of them. However, using this type of pulse animation you can make any image more attractive.
We will know how to add pulse animation on the hover-in button. Above we saw a design where we added a pulse animation to the button. But it is a bit different. Here we do not see any animation in the normal state of the button.
This pulse animation on the hover can be seen when you hover over the button. This means that when you click or hover over the button, we will see this pulse animation in both cases.
In the same way, I first created a button for this. Then I designed the button using CSS and added some normal color change effects to the button.
If you want to download all the source code, you can use the download button above.
All the information for creating a button using the following HTML code has been added.
<!DOCTYPEhtml>
<htmllang="en">
<head>
<!--CSS file-->
<linkrel="stylesheet"href="style.css">
</head>
<body>
<buttonclass="pulse-button-hover">Pulse on hover</button>
</body>
</html>
Now is the time to implement this CSS pulse animation by CSS. A bit more CSS has been used here. Because first the button has been designed then the normal color animation has been added. Then here CSS pulse animation on hover is added to the button here.
Hopefully from this tutorial, you have got all kinds of CSS pulse animation design relationship ideas.
Here I have discussed with you how to create Simple Pulse Animation CSS, button pulse animation, text pulse animation, etc. If you like this article, you can definitely share it on your social media account.