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> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>404 - 页面未找到</title> <title>404 Not Found</title>
<style> <style>
:root { :root {
--bg-color: #f5f7fa; --bg-light: #ffffff;
--card-bg: #ffffff; --bg-dark: #0d1117;
--text-color: #333333; --text-light: #0d1117;
--secondary-text: #666666; --text-dark: #c9d1d9;
--primary-color: #0077ff; --accent: #3b82f6;
--button-hover: #005fcc; }
}
@media (prefers-color-scheme: dark) { body {
:root { margin: 0;
--bg-color: #121212; padding: 0;
--card-bg: #1e1e1e; display: grid;
--text-color: #ffffff; place-items: center;
--secondary-text: #bbbbbb; height: 100vh;
--primary-color: #4dabf7; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--button-hover: #339af0; background-color: var(--bg-light);
} color: var(--text-light);
} transition: background-color 0.3s, color 0.3s;
}
* { h1 {
box-sizing: border-box; font-size: 4rem;
margin: 0; margin: 0;
padding: 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 { body {
font-family: 'Inter', sans-serif; background-color: var(--bg-dark);
background-color: var(--bg-color); color: var(--text-dark);
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;
}
} }
}
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <main>
<h1>404</h1> <h1>404</h1>
<h2>页面未找到</h2> <p>页面未找到,可能已被移除或不存在。</p>
<p>很抱歉,您访问的页面不存在或已被移动。</p> <p><a href="/">返回首页</a></p>
<a href="/" class="btn">返回首页</a> </main>
</div> </body>
</body>
</html> </html>

View File

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