<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<title>TENGYUANUI 404页面</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body, html {
width: 100%;
height: 100%;
overflow: hidden;
font-family: Roboto, sans-serif;
}
/* 全屏背景 */
.fullscreen-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
/* 主体内容 */
.main-content {
position: relative;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: rgba(13, 12, 30, 0.8);
color: #CDD4DE;
text-align: center;
}
/* 头部样式 */
.header {
position: absolute;
top: 30px;
left: 0;
right: 0;
padding: 0 30px;
}
.logo {
margin: 0 auto;
text-align: center;
margin-bottom: -17px;
}
.logo svg {
width: 61px;
height: 14px;
}
.nav-icon {
cursor: pointer;
width: 18px;
height: 18px;
position: relative;
float: left;
}
.nav-icon::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 2px;
background: #565c73;
border-radius: 2px;
box-shadow: 0 5px 0 #565c73, 0 10px 0 #565c73;
}
.search-icon {
float: right;
cursor: pointer;
}
.search-icon svg {
width: 16px;
height: 16px;
}
/* 内容区域 */
.content {
padding: 20px;
max-width: 800px;
}
.error-code {
font-weight: 900;
font-size: 165px;
line-height: 1;
margin-bottom: -10px;
opacity: 0.6;
}
.error-title {
font-weight: 700;
font-size: 34px;
margin-bottom: 6px;
opacity: 0.9;
}
.error-message {
font-weight: 300;
font-size: 14px;
opacity: 0.7;
margin-bottom: 40px;
}
.home-button {
display: inline-block;
font-weight: 300;
font-size: 12px;
text-transform: uppercase;
border: 1px solid #CDD4DE;
padding: 8px 14px;
border-radius: 4px;
opacity: 0.4;
cursor: pointer;
color: #CDD4DE;
text-decoration: none;
transition: opacity 0.3s;
}
.home-button:hover {
opacity: 0.8;
}
/* 背景图片 */
.bg-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
z-index: -2;
transform: scale(1.1);
}
</style>
</head>
<body>
<!-- 全屏背景层 -->
<div class="fullscreen-bg"></div>
<!-- 背景图片 -->
<img class="bg-image" src="http://www.supah.it/dribbble/008/008.jpg" alt="背景图片" />
<!-- 主体内容 -->
<div class="main-content">
<div class="search-icon"><svg><use xlink:href="#ico-search"></use></svg></div>
</header>
<div class="content">
<h1 class="error-code">404</h1>
<h2 class="error-title">页面未找到</h2>
<p class="error-message">我试图抓住一些雾,但我迷失了方向</p>
<a href="https://tyyo.top" class="home-button">返回首页</a>
</div>
</div>
<!-- Logo SVG定义 -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
// 背景图片跟随鼠标移动效果
var followX = 0,
followY = 0,
x = 0,
y = 0,
smoothFactor = 1 / 30;
function animateBackground() {
x += (followX - x) * smoothFactor;
y += (followY - y) * smoothFactor;
var transformValue = 'translate(' + x + 'px, ' + y + 'px) scale(1.1)';
$('.bg-image').css({
'-webkit-transform': transformValue,
'-moz-transform': transformValue,
'transform': transformValue
});
window.requestAnimationFrame(animateBackground);
}
// 监听鼠标移动
$(window).on('mousemove click', function(e) {
// 计算鼠标相对于屏幕中心的位置
var mouseX = Math.max(-100, Math.min(100, $(window).width() / 2 - e.clientX));
var mouseY = Math.max(-100, Math.min(100, $(window).height() / 2 - e.clientY));
// 设置跟随位置,控制移动幅度
followX = (20 * mouseX) / 100;
followY = (10 * mouseY) / 100;
});
// 启动动画
animateBackground();
</script>
</body>
</html>
index.html