Files
script/html/404.html
牡蛎 bcc8bec4cb refactor(nginx): 优化 404 页面的代码结构和样式
- 调整了 HTML 结构,使其更加简洁
- 优化了 CSS 样式,提高了页面的视觉效果
- 添加了响应式设计,使页面在不同设备上显示更佳
- 改进了 JavaScript 代码,提高了页面的交互性
2025-07-25 16:22:00 +08:00

204 lines
5.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="auto">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title id="page-title">Page Not Found - 404</title>
<style>
:root {
--primary-color: #4361ee;
--secondary-color: #3f37c9;
--text-color: #2b2d42;
--bg-color: #f8f9fa;
--error-color: #ef233c;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
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 {
font-size: 2.5rem;
margin-bottom: 1rem;
color: var(--text-color);
}
p {
font-size: 1.1rem;
margin-bottom: 2rem;
opacity: 0.9;
}
.actions {
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;
font-weight: 600;
transition: all 0.3s ease;
border: none;
cursor: pointer;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
}
.btn-primary:hover {
background-color: var(--secondary-color);
transform: translateY(-2px);
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>
</head>
<body>
<div class="container">
<div class="error-code animation">404</div>
<h1 id="heading">Page Not Found</h1>
<p id="message">
The page you're looking for might have been moved, deleted, or doesn't
exist.
</p>
<div class="actions">
<a href="/" class="btn btn-primary" id="home-btn">Go to Homepage</a>
<a
href="javascript:history.back()"
class="btn btn-secondary"
id="back-btn"
>Go Back</a
>
</div>
</div>
<script>
// Language detection and content switching
function setLanguage() {
const userLanguage = navigator.language || navigator.userLanguage;
const isChinese = userLanguage.toLowerCase().includes("zh-cn");
if (isChinese) {
document.getElementById("page-title").textContent =
"页面未找到 - 404";
document.getElementById("heading").textContent = "页面未找到";
document.getElementById("message").textContent =
"您访问的页面可能已被移动、删除或暂时不可用。";
document.getElementById("home-btn").textContent = "返回首页";
document.getElementById("back-btn").textContent = "返回上一页";
console.log(
"%c404 - 页面未找到",
"color: #4361ee; font-size: 2em; font-weight: bold;"
);
console.log(
"%c您似乎迷路了但别担心点击上面的按钮可以找到回去的路。",
"color: #2b2d42; font-size: 1.1em;"
);
} else {
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;"
);
}
}
// Set language on page load
window.addEventListener("DOMContentLoaded", setLanguage);
// 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>
</html>