帮我写一个动态爱心html代码
时间: 2023-10-26 21:39:31 浏览: 87
HTML心形动态满屏爱心代码
5星 · 资源好评率100%
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>动态爱心</title>
<style>
body {
background-color: #f5f5f5;
}
.heart {
position: relative;
display: inline-block;
margin: 50px;
width: 100px;
height: 90px;
}
.heart:before,
.heart:after {
position: absolute;
content: "";
left: 50px;
top: 0px;
width: 50px;
height: 80px;
background: red;
border-radius: 50px 50px 0 0;
transform: rotate(-45deg);
transform-origin: 0 100%;
}
.heart:after {
left: 0;
transform: rotate(45deg);
transform-origin: 100% 100%;
}
.heart:hover:before,
.heart:hover:after {
background: pink;
animation: heartbeat 1s ease-in-out 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>
阅读全文