-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
104 lines (93 loc) · 3.07 KB
/
index.html
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
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<title>Dok0xv's TEST PAGE</title>
<style>
/* 全局样式设置,使页面在手机上能合理显示,去除默认边距等 */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif; /* 设置一个较为通用的字体 */
}
h1, p, h2 {
text-align: center; /* 标题和段落居中显示 */
}
img {
max-width: 100%; /* 图片宽度自适应屏幕,最大不超过自身原始宽度 */
height: auto; /* 高度根据宽度等比例缩放 */
}
/* 爱心样式 */
.heart {
position: absolute;
top: -20px;
width: 20px;
height: 20px;
background-color: pink;
transform: rotate(45deg);
animation: fall 5s linear infinite;
/* 使用border-radius绘制更精细的爱心形状基础部分 */
border-radius: 20px 20px 0 0;
}
/* 使用伪元素绘制爱心的下半部分 */
.heart:before,
.heart:after {
content: "";
position: absolute;
background-color: pink;
}
.heart:before {
width: 20px;
height: 20px;
left: -10px;
top: 0px;
border-radius: 20px 0 0 20px;
}
.heart:after {
width: 20px;
height: 20px;
left: 0px;
top: 10px;
border-radius: 0 20px 20px 0;
}
/* 动画关键帧,定义爱心飘落的过程 */
@keyframes fall {
0% {
top: -20px;
opacity: 0;
}
20% {
opacity: 0.8;
}
100% {
top: 100vh;
opacity: 0;
}
}
</style>
</head>
<body>
<h1>您好,欢迎您的访问!</h1><br>
<h2>Welcome!</h2>
<br>
<!--<video src="https://cdn.jsdelivr.net/gh/Dok0xv/Dok0xv.github.io@main/testvid3.mp4" autoplay="autoplay" muted="muted"></video>-->
<img src="https://cdn.glitch.global/b99977e0-ba9f-4ad1-bf49-0e0549ded5d6/cat.jpg?v=1657088754180" />
<h3>这是我的微信(小号):</h3>
<img src="https://cdn.glitch.global/ad99c100-74e5-45ca-98e3-00b2f5e8890a/WeChat_Doko.jpg?v=1734861479096"/>
<h3>请惠存,如果遇到计算机相关的问题,欢迎向我询问!</h3>
<!-- 使用JavaScript动态创建爱心元素 -->
<script>
// 获取页面的body元素
const body = document.body;
// 循环创建多个爱心元素,这里数量设为20,可按需调整
for (let i = 0; i < 20; i++) {
const heart = document.createElement('div');
heart.classList.add('heart');
body.appendChild(heart);
// 随机设置爱心的初始位置(水平方向)
const x = Math.random() * window.innerWidth;
heart.style.left = `${x}px`;
}
</script>
</body>
</html>