1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
| <!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>生日快乐,我的爱人!</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&family=Montserrat:wght@400;700&display=swap');
body {
margin: 0;
padding: 0;
height: 100vh;
overflow: hidden;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
font-family: 'Montserrat', sans-serif;
display: flex;
justify-content: center;
align-items: center;
color: #333;
}
.container {
position: relative;
width: 90%;
max-width: 800px;
background: rgba(255, 255, 255, 0.9);
border-radius: 20px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
padding: 40px;
text-align: center;
z-index: 10;
backdrop-filter: blur(5px);
animation: fadeIn 1.5s ease-out;
overflow: hidden;
}
h1 {
font-family: 'Dancing Script', cursive;
font-size: 3.5rem;
color: #ff6b6b;
margin-bottom: 20px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}
.birthday-girl {
font-size: 1.8rem;
color: #6b5b95;
margin-bottom: 30px;
}
.message {
font-size: 1.2rem;
line-height: 1.8;
margin-bottom: 30px;
}
.heart {
color: #ff6b6b;
font-size: 1.5rem;
animation: pulse 1.5s infinite;
}
.birthday-date {
font-size: 1.3rem;
color: #6b5b95;
margin: 20px 0;
}
.btn {
display: inline-block;
padding: 12px 30px;
background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
color: white;
border: none;
border-radius: 50px;
font-size: 1.1rem;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
margin-top: 20px;
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 8px 20px rgba(255, 107, 107, 0.6);
}
.btn:active {
transform: translateY(1px);
}
/* 动画效果 */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.3); }
100% { transform: scale(1); }
}
/* 漂浮的爱心 */
.floating-hearts {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
}
.heart-shape {
position: absolute;
width: 20px;
height: 20px;
background-color: #ff6b6b;
transform: rotate(45deg);
opacity: 0;
}
.heart-shape:before, .heart-shape:after {
content: '';
width: 20px;
height: 20px;
background-color: #ff6b6b;
border-radius: 50%;
position: absolute;
}
.heart-shape:before {
top: -10px;
left: 0;
}
.heart-shape:after {
top: 0;
left: -10px;
}
/* 照片框 */
.photo-frame {
width: 200px;
height: 200px;
margin: 20px auto;
border-radius: 50%;
border: 5px solid #fff;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
overflow: hidden;
position: relative;
}
.photo-frame img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* 响应式设计 */
@media (max-width: 768px) {
h1 {
font-size: 2.5rem;
}
.birthday-girl {
font-size: 1.5rem;
}
.message {
font-size: 1rem;
}
.container {
padding: 30px 20px;
}
}
</style>
</head>
<body>
<div class="floating-hearts" id="hearts-container"></div>
<div class="container">
<h1>生日快乐!</h1>
<div class="photo-frame">
<!-- 这里可以替换成你女朋友的照片 -->
<img src="https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80" alt="生日女孩">
</div>
<div class="birthday-girl">致我最爱的女孩</div>
<div class="birthday-date">2003年4月15日 - 2023年4月15日</div>
<div class="message">
亲爱的,今天是你的20岁生日!<br>
感谢你出现在我的生命中,让我的世界变得更加美好。<br>
愿你的每一天都充满欢笑和幸福,<br>
愿你的梦想都能实现,<br>
愿我们的爱情像美酒一样,越久越醇香。<br>
生日快乐,我的爱人!<span class="heart">❤</span>
</div>
<button class="btn" id="surpriseBtn">点击有惊喜</button>
</div>
<script>
// 创建漂浮的爱心
function createHearts() {
const container = document.getElementById('hearts-container');
const colors = ['#ff6b6b', '#ff8e8e', '#ffb3b3', '#ffd8d8'];
for (let i = 0; i < 15; i++) {
const heart = document.createElement('div');
heart.className = 'heart-shape';
// 随机属性
const size = Math.random() * 15 + 10;
const posX = Math.random() * window.innerWidth;
const posY = Math.random() * window.innerHeight;
const delay = Math.random() * 5;
const duration = Math.random() * 10 + 10;
const color = colors[Math.floor(Math.random() * colors.length)];
heart.style.width = `${size}px`;
heart.style.height = `${size}px`;
heart.style.left = `${posX}px`;
heart.style.top = `${posY}px`;
heart.style.animation = `float ${duration}s ease-in-out ${delay}s infinite`;
heart.style.backgroundColor = color;
// 设置伪元素的颜色
heart.style.setProperty('--heart-color', color);
container.appendChild(heart);
// 添加浮动动画
const keyframes = `
@keyframes float {
0% {
transform: translateY(0) rotate(45deg) scale(1);
opacity: 0;
}
10% {
opacity: 1;
}
90% {
opacity: 1;
}
100% {
transform: translateY(-100vh) rotate(45deg) scale(0.5);
opacity: 0;
}
}
`;
const style = document.createElement('style');
style.innerHTML = keyframes;
document.head.appendChild(style);
}
}
// 惊喜按钮功能
document.getElementById('surpriseBtn').addEventListener('click', function() {
const container = document.querySelector('.container');
container.style.background = 'linear-gradient(45deg, #ff6b6b, #ff8e8e)';
container.style.color = 'white';
const h1 = document.querySelector('h1');
h1.style.color = 'white';
h1.style.textShadow = '2px 2px 4px rgba(0, 0, 0, 0.3)';
const message = document.querySelector('.message');
message.innerHTML = '我爱你胜过这世间的万物!<br>愿我们的爱情天长地久!<span class="heart">❤</span>';
// 创建更多爱心
for (let i = 0; i < 20; i++) {
setTimeout(createHearts, i * 100);
}
this.textContent = '我爱你!';
this.style.background = 'white';
this.style.color = '#ff6b6b';
});
// 页面加载时创建一些爱心
window.addEventListener('load', function() {
createHearts();
});
</script>
</body>
</html>
|