写一个爱心代码 实现html界面
时间: 2023-10-26 11:36:53 浏览: 36
<!DOCTYPE html>
<html>
<head>
<title>爱心代码</title>
<style>
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.heart {
position: relative;
animation: pulse 2s infinite;
width: 100px;
height: 100px;
transform: rotate(45deg);
background-color: pink;
}
.heart:before,
.heart:after {
content: "";
position: absolute;
border-radius: 50%;
background-color: pink;
}
.heart:before {
top: 0;
left: 50px;
width: 50px;
height: 50px;
}
.heart:after {
top: 50px;
left: 0;
width: 50px;
height: 50px;
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
</style>
</head>
<body>
<div class="container">
<div class="heart"></div>
</div>
</body>
</html>