refactor/nginx: 优化 404 页面和首页的样式

- 重新设计了 404 页面的布局和样式,使其更加简洁和响应式
- 添加了暗黑模式支持,提升用户体验
- 优化了首页的样式,增加了链接的视觉效果
This commit is contained in:
2025-06-08 11:42:47 +08:00
parent 12bff5f3b5
commit d47715ee40
2 changed files with 62 additions and 97 deletions

View File

@@ -1,108 +1,63 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>404 - 页面未找到</title>
<title>404 Not Found</title>
<style>
:root {
--bg-color: #f5f7fa;
--card-bg: #ffffff;
--text-color: #333333;
--secondary-text: #666666;
--primary-color: #0077ff;
--button-hover: #005fcc;
}
:root {
--bg-light: #ffffff;
--bg-dark: #0d1117;
--text-light: #0d1117;
--text-dark: #c9d1d9;
--accent: #3b82f6;
}
@media (prefers-color-scheme: dark) {
:root {
--bg-color: #121212;
--card-bg: #1e1e1e;
--text-color: #ffffff;
--secondary-text: #bbbbbb;
--primary-color: #4dabf7;
--button-hover: #339af0;
}
}
body {
margin: 0;
padding: 0;
display: grid;
place-items: center;
height: 100vh;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
background-color: var(--bg-light);
color: var(--text-light);
transition: background-color 0.3s, color 0.3s;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
h1 {
font-size: 4rem;
margin: 0;
}
p {
font-size: 1.2rem;
margin: 1rem 0;
}
a {
color: var(--accent);
text-decoration: none;
font-weight: 500;
}
a:hover {
text-decoration: underline;
}
@media (prefers-color-scheme: dark) {
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.container {
text-align: center;
padding: 40px;
background: var(--card-bg);
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
max-width: 500px;
width: 90%;
transition: background 0.3s ease, color 0.3s ease;
}
.container h1 {
font-size: 96px;
font-weight: 600;
color: var(--primary-color);
margin-bottom: 10px;
}
.container h2 {
font-size: 28px;
margin-bottom: 20px;
}
.container p {
font-size: 16px;
margin-bottom: 30px;
color: var(--secondary-text);
}
.btn {
display: inline-block;
padding: 12px 24px;
background-color: var(--primary-color);
color: white;
border: none;
border-radius: 6px;
font-size: 16px;
text-decoration: none;
transition: background-color 0.3s ease;
}
.btn:hover {
background-color: var(--button-hover);
}
@media (max-width: 600px) {
.container h1 {
font-size: 72px;
}
.container h2 {
font-size: 22px;
}
background-color: var(--bg-dark);
color: var(--text-dark);
}
}
</style>
</head>
<body>
<div class="container">
<h1>404</h1>
<h2>页面未找到</h2>
<p>很抱歉,您访问的页面不存在或已被移动。</p>
<a href="/" class="btn">返回首页</a>
</div>
</body>
</head>
<body>
<main>
<h1>404</h1>
<p>页面未找到,可能已被移除或不存在。</p>
<p><a href="/">返回首页</a></p>
</main>
</body>
</html>

View File

@@ -46,6 +46,16 @@
align-items: center;
flex-wrap: wrap;
}
a {
color: #3b82f6;
text-decoration: none;
font-weight: 500;
}
a:hover {
text-decoration: underline;
}
</style>
</head>