24数科、智科、虚拟实验课作业

注意

点击代码块,可使用方向键左右移动查看代码
注释部分不需要敲
可以去课堂资源下载我们的images.zip压缩包并放在正确位置,也可以自行更改代码改为你喜欢的主页
推荐在电脑上分屏敲,一半浏览器、一半Hbuilder~
提交运行后截图,注意改脚标你的名字

参考一下两个代码,设计一个你喜欢的主题页面,也可在以下两个代码里二选一复现,一个原神主题一个三角洲主题,图片可自行从网络获取

原神示例

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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>原神 - 主页</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: "Microsoft YaHei", sans-serif;
color: #1e293b;
background: #f5f7fa;
line-height: 1.6;
padding-top: 100vh;
}

/* ============ 导航栏(flex 布局) ============ */
.nav {
display: flex;
align-items: center;
background: linear-gradient(90deg, rgba(96, 165, 250, 0.95), rgba(168, 85, 247, 0.95));
padding: 0 32px;
height: 64px;
box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10;
backdrop-filter: blur(8px);
}

.logo {
width: 44px;
height: 44px;
border-radius: 50%;
background: linear-gradient(135deg, #60a5fa, #a855f7);
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
font-weight: 700;
font-size: 1.2rem;
transition: transform 0.2s;
}

.logo:hover {
transform: rotate(15deg) scale(1.1);
}

.separator {
width: 1px;
height: 28px;
background: rgba(255, 255, 255, 0.3);
margin: 0 20px;
}

.nav-box {
display: flex;
gap: 8px;
flex: 1;
}

.nav-box a {
color: #ffffff;
text-decoration: none;
padding: 8px 16px;
border-radius: 8px;
font-size: 0.95rem;
transition: all 0.2s;
}

.nav-box a:hover {
background: rgba(255, 255, 255, 0.2);
color: #ffffff;
}

.login {
background: rgba(255, 255, 255, 0.95);
color: #6366f1;
padding: 8px 20px;
border-radius: 20px;
text-decoration: none;
font-size: 0.9rem;
font-weight: 600;
transition: all 0.2s;
}

.login:hover {
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(255, 255, 255, 0.4);
background: #ffffff;
}

/* ============ 大图区域 ============ */
.hero {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background-image: url('images/genshin/1.png');
background-size: cover;
background-position: center;
z-index: 0;
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
text-align: center;
}

.hero::before {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(30, 58, 138, 0.4), rgba(124, 58, 237, 0.3));
}

.hero-content {
position: relative;
z-index: 1;
}

.hero h1 {
font-size: 5rem;
font-weight: 800;
letter-spacing: 0.5rem;
text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
margin-bottom: 12px;
}

.hero p {
font-size: 1.3rem;
opacity: 0.95;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ============ 网格展示区(叠加在 hero 之上) ============ */
.section {
position: relative;
z-index: 1;
max-width: 1200px;
margin: 0 auto;
padding: 60px 24px;
}

.section h2 {
text-align: center;
font-size: 1.8rem;
margin-bottom: 40px;
color: #1e293b;
position: relative;
}

.section h2::after {
content: "";
display: block;
width: 60px;
height: 3px;
background: linear-gradient(90deg, #60a5fa, #a855f7);
margin: 12px auto 0;
border-radius: 2px;
}

.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}

.card {
background: #ffffff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
transition: all 0.3s;
cursor: pointer;
}

.card:hover {
transform: translateY(-8px);
box-shadow: 0 16px 32px rgba(99, 102, 241, 0.25);
}

.card img {
width: 100%;
height: 200px;
object-fit: cover;
display: block;
transition: transform 0.4s;
}

.card:hover img {
transform: scale(1.08);
}

.card-body {
padding: 16px;
text-align: center;
}

.card-body h3 {
font-size: 1.05rem;
margin-bottom: 4px;
color: #1e293b;
}

.card-body p {
font-size: 0.85rem;
color: #64748b;
}

/* ============ 页脚 ============ */
.footer {
position: relative;
z-index: 1;
background: #1e293b;
color: #cbd5e1;
text-align: center;
padding: 24px;
font-size: 0.9rem;
}

.footer a {
color: #60a5fa;
text-decoration: none;
}
</style>
</head>
<body>

<!-- 导航栏(flex 布局) -->
<nav class="nav">
<div class="logo"></div>
<div class="separator"></div>
<div class="nav-box">
<a href="#">首页</a>
<a href="#">角色</a>
<a href="#">武器</a>
<a href="#">地图</a>
<a href="#">社区</a>
</div>
<a href="#" class="login">登录</a>
</nav>

<!-- 大图 -->
<div class="hero">
<div class="hero-content">
<h1>原 神</h1>
<p>提瓦特大陆 · 开放世界冒险 RPG</p>
</div>
</div>

<!-- 角色展示(grid 布局) -->
<div class="section">
<h2>角色展示</h2>
<div class="grid">
<div class="card">
<img src="images/genshin/char1.jpg" alt="温迪">
<div class="card-body">
<h3>温迪</h3>
<p>风神 · 蒙德</p>
</div>
</div>
<div class="card">
<img src="images/genshin/char2.jpg" alt="胡桃">
<div class="card-body">
<h3>胡桃</h3>
<p>往生堂 · 璃月</p>
</div>
</div>
<div class="card">
<img src="images/genshin/char3.jpg" alt="刻晴">
<div class="card-body">
<h3>刻晴</h3>
<p>玉衡星 · 璃月</p>
</div>
</div>
<div class="card">
<img src="images/genshin/char4.jpg" alt="钟离">
<div class="card-body">
<h3>钟离</h3>
<p>岩王爷 · 璃月</p>
</div>
</div>
</div>
</div>

<!-- 地图展示(grid 布局) -->
<div class="section">
<h2>地图探索</h2>
<div class="grid">
<div class="card">
<img src="images/genshin/map1.jpg" alt="蒙德">
<div class="card-body">
<h3>蒙德城</h3>
<p>风之国度</p>
</div>
</div>
<div class="card">
<img src="images/genshin/map2.jpg" alt="璃月">
<div class="card-body">
<h3>璃月港</h3>
<p>岩之契约</p>
</div>
</div>
<div class="card">
<img src="images/genshin/map3.jpg" alt="稻妻">
<div class="card-body">
<h3>稻妻城</h3>
<p>雷之永恒</p>
</div>
</div>
<div class="card">
<img src="images/genshin/map4.jpg" alt="须弥">
<div class="card-body">
<h3>须弥城</h3>
<p>草之智慧</p>
</div>
</div>
</div>
</div>

<!-- 页脚 -->
<div class="footer">
<p>© (你的名字)· 仅供学习使用 · <a href="#">返回顶部</a></p>
</div>

</body>
</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
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>三角洲行动 - 主页</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
font-family: "Microsoft YaHei", sans-serif;
color: #e2e8f0;
background: #0f172a;
line-height: 1.6;
padding-top: 100vh;
}

/* ============ 导航栏(flex 布局) ============ */
.nav {
display: flex;
align-items: center;
background: #1e293b;
padding: 0 32px;
height: 64px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 10;
border-bottom: 1px solid #334155;
}

.logo {
width: 44px;
height: 44px;
border-radius: 8px;
background: linear-gradient(135deg, #f97316, #dc2626);
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
font-weight: 800;
font-size: 1.2rem;
transition: transform 0.2s;
}

.logo:hover {
transform: rotate(15deg) scale(1.1);
}

.separator {
width: 1px;
height: 28px;
background: #334155;
margin: 0 20px;
}

.nav-box {
display: flex;
gap: 8px;
flex: 1;
}

.nav-box a {
color: #cbd5e1;
text-decoration: none;
padding: 8px 16px;
border-radius: 8px;
font-size: 0.95rem;
transition: all 0.2s;
}

.nav-box a:hover {
background: #f97316;
color: #ffffff;
}

.login {
background: #f97316;
color: #ffffff;
padding: 8px 20px;
border-radius: 6px;
text-decoration: none;
font-size: 0.9rem;
font-weight: 600;
transition: all 0.2s;
}

.login:hover {
background: #ea580c;
transform: translateY(-2px);
box-shadow: 0 6px 16px rgba(249, 115, 22, 0.4);
}

/* ============ 大图区域(铺满全屏底层) ============ */
.hero {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background-image: url('images/delta/1.jpg');
background-size: cover;
background-position: center;
z-index: 0;
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
text-align: center;
}

.hero::before {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(127, 29, 29, 0.4));
}

.hero-content {
position: relative;
z-index: 1;
}

.hero h1 {
font-size: 5rem;
font-weight: 900;
letter-spacing: 0.3rem;
text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
margin-bottom: 12px;
}

.hero p {
font-size: 1.3rem;
opacity: 0.95;
text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ============ 网格展示区(叠加在 hero 之上) ============ */
.section {
position: relative;
z-index: 1;
max-width: 1200px;
margin: 0 auto;
padding: 60px 24px;
}

.section h2 {
text-align: center;
font-size: 1.8rem;
margin-bottom: 40px;
color: #f1f5f9;
position: relative;
}

.section h2::after {
content: "";
display: block;
width: 60px;
height: 3px;
background: linear-gradient(90deg, #f97316, #dc2626);
margin: 12px auto 0;
border-radius: 2px;
}

.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}

.card {
background: #1e293b;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
transition: all 0.3s;
cursor: pointer;
border: 1px solid #334155;
}

.card:hover {
transform: translateY(-8px);
border-color: #f97316;
box-shadow: 0 16px 32px rgba(249, 115, 22, 0.4);
}

.card img {
width: 100%;
height: 200px;
object-fit: cover;
display: block;
transition: transform 0.4s;
filter: brightness(0.9);
}

.card:hover img {
transform: scale(1.08);
filter: brightness(1.1);
}

.card-body {
padding: 16px;
text-align: center;
}

.card-body h3 {
font-size: 1.05rem;
margin-bottom: 4px;
color: #f1f5f9;
}

.card-body p {
font-size: 0.85rem;
color: #94a3b8;
}

/* ============ 页脚 ============ */
.footer {
position: relative;
z-index: 1;
background: #020617;
color: #64748b;
text-align: center;
padding: 24px;
font-size: 0.9rem;
border-top: 1px solid #1e293b;
}

.footer a {
color: #f97316;
text-decoration: none;
}
</style>
</head>
<body>

<!-- 导航栏(flex 布局) -->
<nav class="nav">
<div class="logo">Δ</div>
<div class="separator"></div>
<div class="nav-box">
<a href="#">首页</a>
<a href="#">干员</a>
<a href="#">枪械</a>
<a href="#">地图</a>
<a href="#">瓦友社区</a>
</div>
<a href="#" class="login">登录账号</a>
</nav>

<!-- 大图 -->
<div class="hero">
<div class="hero-content">
<h1>三角洲行动</h1>
<p>特种干员 · 战术射击 · 危险降临</p>
</div>
</div>

<!-- 干员展示(grid 布局) -->
<div class="section">
<h2>干员展示</h2>
<div class="grid">
<div class="card">
<img src="images/delta/op1.jpg" alt="红狼">
<div class="card-body">
<h3>红狼</h3>
<p>突击干员 · GTI</p>
</div>
</div>
<div class="card">
<img src="images/delta/op2.jpg" alt="牧羊人">
<div class="card-body">
<h3>牧羊人</h3>
<p>工程干员 · GTI</p>
</div>
</div>
<div class="card">
<img src="images/delta/op3.jpg" alt="露娜">
<div class="card-body">
<h3>露娜</h3>
<p>侦察干员 · GTI</p>
</div>
</div>
<div class="card">
<img src="images/delta/op4.jpg" alt="蜂医">
<div class="card-body">
<h3>蜂医</h3>
<p>支援干员 · GTI</p>
</div>
</div>
</div>
</div>

<!-- 地图展示(grid 布局) -->
<div class="section">
<h2>地图模式</h2>
<div class="grid">
<div class="card">
<img src="images/delta/map1.jpg" alt="源工重镇">
<div class="card-body">
<h3>源工重镇</h3>
<p>大型攻防地图</p>
</div>
</div>
<div class="card">
<img src="images/delta/map2.jpg" alt="隐世修所">
<div class="card-body">
<h3>隐世修所</h3>
<p>秘密潜入任务</p>
</div>
</div>
<div class="card">
<img src="images/delta/map3.jpg" alt="霓虹町">
<div class="card-body">
<h3>霓虹町</h3>
<p>都市激战</p>
</div>
</div>
<div class="card">
<img src="images/delta/map4.jpg" alt="亚海悬城">
<div class="card-body">
<h3>亚海悬城</h3>
<p>海岛行动</p>
</div>
</div>
</div>
</div>

<!-- 页脚 -->
<div class="footer">
<p>© (你的名字) · 仅供学习使用 · <a href="#">返回顶部</a></p>
</div>

</body>
</html>