请帮我写一串html实现爱心跳动的代码
时间: 2023-11-22 15:29:00 浏览: 50
爱心跳动.html
<!DOCTYPE html>
<html>
<head>
<title>Heartbeat Animation</title>
<style>
/*定义心形样式*/
.heart {
position: absolute;
top: 50%;
left: 50%;
width: 50px;
height: 50px;
background-color: red;
transform: translate(-50%, -50%) rotate(-45deg);
animation: heartbeat 1s linear infinite;
}
/*定义心跳动画*/
@keyframes heartbeat {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
</style>
</head>
<body>
<div class="heart"></div>
</body>
</html>
阅读全文