纯html css实现爱心案例
原理:
心型❤️是可以由半个正方向+两个半圆形构成的
如图
得到这样的图形后 再旋转45度角,就可以变成爱心形状了
<!DOCTYPE html>
<html lang="zh">
<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></title>
<style>
.heart
{
position: absolute;
width: 100px;
height: 100px;
background-color: yellow;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
transform: rotate(-45deg);
}
.left
{
position: absolute;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #00A4FF;
top:-50px;
}
.right
{
position: absolute;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #4cffab;
left: 50px;
}
</style>
</head>
<body>
<div class="heart">
<div class="left">
</div>
<div class="right">
</div>
</div>
</body>
</html>
把颜色变成一样就能变成爱心了