Heartbeat Effect Pure HTML and CSS
Hello !
Welcome back, with me the founder of Syiainfoku. You will learn together on the Syiainfoku blog how to make a Heartbeat Effect no JavaScript pure HTML and CSS.
Ok, let's get started
Preview Heartbeat Effect
More or less the result will be like in the picture above.
Source Code and Brief Explanation
To make this program [Heartbeat Effect]. First you need to create two Files, one HTML File and one CSS File. After creating these files, just paste the following code into your file. You can also download the source code file of this Heartbeat Effect from the given download button.
First, create an HTML file with the name index.html and paste the given code in your HTML file. Remember, you must create a file with an .html extension.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Heartbeat Effect | hitoricoding</title>
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<div class="heart"></div>
</body>
</html>
Finally, create a CSS file with the name style.css and paste the given code in your CSS file. Remember, you must create a file with a .css extension.
body {
margin: 0;
padding: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef6ff;
}
.heart {
height: 70px;
width: 70px;
background: #ed2860;
position: relative;
transform: rotate(-45deg);
box-shadow: -10px 10px 90px #ff0048;
animation: heartKU 0.6s linear infinite;
}
@keyframes heartKU {
0% {
transform: rotate(-45deg) scale(1.07);
}
80% {
transform: rotate(-45deg) scale(1.0);
}
100% {
transform: rotate(-45deg) scale(0.8);
}
}
.heart::before {
content: '';
position: absolute;
height: 70px;
width: 70px;
background: #ed2860;
top: -50%;
border-radius: 50px;
box-shadow: -10px -10px 90px #ff0048;
}
.heart::after {
content: '';
position: absolute;
height: 70px;
width: 70px;
background: #ed2860;
right: -50%;
border-radius: 50px;
box-shadow: 10px 10px 90px #ff0048;
}
That's it, now you have successfully created a Heartbeat Effect, If your code is not working or you are facing any error/problem, please download the source code file from the given download button. It's free and a .zip file will be downloaded then you have to extract it.
Closing
Thank you for those of you who have read and downloaded this source code, hopefully it can be useful and add to your insight.
If you found this article useful, you can share it. That's all from me, and THANK YOU
Post a Comment