How to make a heart using css and html
You copy and paste it and save it Heart.html
<!DOCTYPE html>
<html>
<head>
<title>Heart Animation using CSS And HTML</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
background: #2c3e50
}
.box {
width: 300px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
}
.heart {
position: relative;
margin: auto;
height: 170px;
width: 200px;
animation: animate 1s infinite;
}
.heart:before, .heart:after {
content: '';
position: absolute;
background: #d63031;
width: 100px;
height: 160px;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
}
.heart:before {
left: 100px;
transform: rotate(-45deg);
transform-origin: 0 100%;
box-shadow: 0 14px 28px rgba(0,0,0,0.25),
0 10px 10px rgba(0,0,0,0.22);
}
.heart:after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
@keyframes animate {
0% {
transform: scale(1);
}
30% {
transform: scale(.8);
}
60% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
</style>
</head>
<body>
<div class="box">
<div class="heart"></div>
</div>
</body>
</html>
Output