feat/nginx: 重构 404 页面布局和样式

- 设计了新的 404 页面布局,增加了更多视觉元素
- 添加了响应式样式,优化了移动端体验
- 增加了交互效果,提升了用户参与度
- 优化了代码结构,提高了页面加载速度
This commit is contained in:
2025-07-23 18:52:35 +08:00
parent b16d2e0163
commit 552bb87a0d

View File

@@ -1,63 +1,162 @@
<!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 Not Found</title> <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<title>Page Not Found - 404</title>
<style> <style>
:root { :root {
--bg-light: #ffffff; --primary-color: #4361ee;
--bg-dark: #0d1117; --secondary-color: #3f37c9;
--text-light: #0d1117; --text-color: #2b2d42;
--text-dark: #c9d1d9; --bg-color: #f8f9fa;
--accent: #3b82f6; --error-color: #ef233c;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
} }
body { body {
margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
padding: 0; background-color: var(--bg-color);
display: grid; color: var(--text-color);
place-items: center; line-height: 1.6;
height: 100vh; display: flex;
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; flex-direction: column;
background-color: var(--bg-light); align-items: center;
color: var(--text-light); justify-content: center;
transition: background-color 0.3s, color 0.3s; min-height: 100vh;
padding: 2rem;
text-align: center;
}
.container {
max-width: 600px;
width: 100%;
}
.error-code {
font-size: 8rem;
font-weight: 800;
color: var(--primary-color);
margin-bottom: 1rem;
position: relative;
display: inline-block;
}
.error-code::after {
content: '404';
position: absolute;
top: 0;
left: 0;
color: rgba(67, 97, 238, 0.1);
z-index: -1;
transform: scale(1.5);
} }
h1 { h1 {
font-size: 4rem; font-size: 2.5rem;
margin: 0; margin-bottom: 1rem;
color: var(--text-color);
} }
p { p {
font-size: 1.2rem; font-size: 1.1rem;
margin: 1rem 0; margin-bottom: 2rem;
opacity: 0.9;
} }
a { .actions {
color: var(--accent); display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
}
.btn {
display: inline-block;
padding: 0.8rem 1.8rem;
border-radius: 50px;
text-decoration: none; text-decoration: none;
font-weight: 500; font-weight: 600;
transition: all 0.3s ease;
border: none;
cursor: pointer;
} }
a:hover { .btn-primary {
text-decoration: underline; background-color: var(--primary-color);
color: white;
} }
@media (prefers-color-scheme: dark) { .btn-primary:hover {
body { background-color: var(--secondary-color);
background-color: var(--bg-dark); transform: translateY(-2px);
color: var(--text-dark); box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
}
.btn-secondary {
background-color: transparent;
color: var(--primary-color);
border: 2px solid var(--primary-color);
}
.btn-secondary:hover {
background-color: rgba(67, 97, 238, 0.1);
transform: translateY(-2px);
}
.animation {
animation: float 6s ease-in-out infinite;
}
@keyframes float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-20px);
}
}
@media (max-width: 768px) {
.error-code {
font-size: 6rem;
}
h1 {
font-size: 2rem;
} }
} }
</style> </style>
</head> </head>
<body> <body>
<main> <div class="container">
<h1>404</h1> <div class="error-code animation">404</div>
<p>页面未找到,可能已被移除或不存在。</p> <h1>Page Not Found</h1>
<p><a href="/">返回首页</a></p> <p>The page you're looking for might have been moved, deleted, or doesn't exist.</p>
</main> <div class="actions">
<a href="/" class="btn btn-primary">Go to Homepage</a>
<a href="javascript:history.back()" class="btn btn-secondary">Go Back</a>
</div>
</div>
<script>
// Console message
console.log('%c404 - Page Not Found', 'color: #4361ee; font-size: 2em; font-weight: bold;');
console.log('%cLooks like you\'re lost! Use the buttons above to find your way back.', 'color: #2b2d42; font-size: 1.1em;');
// Simple parallax effect
document.addEventListener('mousemove', function(e) {
const container = document.querySelector('.container');
const xAxis = (window.innerWidth / 2 - e.pageX) / 25;
const yAxis = (window.innerHeight / 2 - e.pageY) / 25;
container.style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
});
</script>
</body> </body>
</html> </html>