<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
width: 200px;
height: 200px;
background-color: crimson;
margin: 250px auto;
transition: 2s;
animation: heart 2s infinite linear;
}
/* 在div后面添加半个圆 */
div::after {
content: '';
width: 200px;
height: 200px;
display: inline-block;
border-radius: 50%;
background-color: crimson;
position: relative;
top: -300px;
left: 0;
}
div::before {
content: '';
width: 200px;
height: 200px;
display: inline-block;
border-radius: 50%;
background-color: crimson;
position: relative;
/* top: -120px; */
left: -100px;
}
@keyframes heart {
0%,
100% {
transform: scale(0.5) rotateZ(45deg);
}
50% {
transform: scale(1.1) rotateZ(45deg);
}
}
</style>
</head>
<body>
<div id="xin"></div>
</body>
</html>
转载地址:https://blog.csdn.net/blinH/article/details/107869416