<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>爱心闪烁动画</title>
</head>
<body>
<style>
@keyframes heartbeat {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
.heart {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
animation: heartbeat 1s ease-in-out infinite;
color: red;
font-size: 50px;
}
</style>
<div class="heart">谢红燕</div>
</body>
</html>
将这个文件在记事本里打开,另存为,编码选择utf8
以上便是如何在HTML页面中实现旋转动画用到的知识点和简单的案例