Learn How to Make Heart Shape using CSS Only
HTML Code
<html>
<head>
<title>Shape</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div class="container">
<div class="heart-shape"></div>
</div>
</body>
</html>
CSS Code
body{
margin:0;
}
*{
box-sizing: border-box;
}
.container{
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.heart-shape{
width: 200px;
height: 200px;
background-color: red;
position: relative;
transform: rotate(45deg);
}
.heart-shape:before, .heart-shape:after{
width: 200px;
height: 200px;
background-color: red;
content: '';
position: absolute;
border-radius: 50%;
}
.heart-shape::before{
bottom: 0px;
left: -100px;
}
.heart-shape::after{
bottom: 0px;
top: -100px;
}