使用css3画一颗跳动的心
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
background: #000;
}
.heart{
width: 100px;
height: 100px;
background: red;
margin:100px auto 0;
position: relative;
transform: rotate(-45deg);
animation: putongputong 2s infinite;
}
.heart:after{
display: block;
content: '';
width: 100px;
height: 100px;
border-radius: 50%;
background: red;
position: absolute;
top: -50px;
left: 0;
}
.heart:before{
display: block;
content: '';
width: 100px;
height: 100px;
border-radius: 50%;
background: red;
position: absolute;
right: -50px;
top: 0;
}
@keyframes putongputong{
0%{
transform: rotate(-45deg) scale(0.8);
}
50%{
transform: rotate(-45deg) scale(1.2);
}
100%{
transform: rotate(-45deg) scale(0.8);
}
}
</style>
</head>
<body>
<div class="heart"></div>
</body>
</html>