<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>情人节快乐!</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(135deg, #ff9a9e, #fad0c4);
font-family: 'Microsoft Yahei', sans-serif;
overflow: hidden;
}
.container {
text-align: center;
padding: 2rem;
background: rgba(255, 255, 255, 0.9);
border-radius: 15px;
box-shadow: 0 0 20px rgba(255, 192, 203, 0.5);
position: relative;
}
h1 {
color: #ff69b4;
font-size: 2.5rem;
margin-bottom: 1rem;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}
.message {
color: #ff1493;
font-size: 1.2rem;
line-height: 1.6;
max-width: 400px;
margin: 1rem auto;
opacity: 0;
transition: opacity 1s;
}
.show {
opacity: 1;
}
.heart-btn {
background: #ff69b4;
color: white;
border: none;
padding: 1rem 2rem;
border-radius: 30px;
font-size: 1.2rem;
cursor: pointer;
transition: transform 0.3s, background 0.3s;
}
.heart-btn:hover {
background: #ff1493;
transform: scale(1.1);
}
.heart {
position: absolute;
pointer-events: none;
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0) rotate(0deg); }
50% { transform: translateY(-20px) rotate(20deg); }
}
.heart::before,
.heart::after {
content: '';
position: absolute;
width: 10px;
height: 16px;
background: #ff69b4;
border-radius: 10px 10px 0 0;
}
.heart::before {
transform: rotate(-45deg);
}
.heart::after {
left: 6px;
transform: rotate(45deg);
}
</style>
</head>
<body>
<div class="container">
<h1>💖周盼盼, 情人节快乐! 💖</h1>
<button class="heart-btn" onclick="showMessage()">点击接收祝福</button>
<p class="message" id="message">在这特别的日子里,愿我们的爱情如玫瑰般绽放,似星辰般永恒。你的每个微笑都是我生命中最美的礼物,爱你直到永远!</p>
</div>
<script>
function showMessage() {
document.getElementById('message').classList.add('show');
createHearts();
document.querySelector('.heart-btn').style.display = 'none';
}
function createHearts() {
for(let i = 0; i < 20; i++) {
const heart = document.createElement('div');
heart.className = 'heart';
heart.style.left = Math.random() * 100 + 'vw';
heart.style.animationDelay = Math.random() * 2 + 's';
document.body.appendChild(heart);
setTimeout(() => {
heart.remove();
}, 3000);
}
}
// 鼠标移动特效
document.addEventListener('mousemove', (e) => {
if(Math.random() > 0.9) {
const heart = document.createElement('div');
heart.className = 'heart';
heart.style.left = e.pageX + 'px';
heart.style.top = e.pageY + 'px';
document.body.appendChild(heart);
setTimeout(() => {
heart.remove();
}, 3000);
}
});
</script>
</body>
</html>
index.html
style.css
index.js
index.html