本源码是一款极具个性的「404 页面未找到」单页模板,采用深蓝黑背景搭配紫、青双色霓虹渐变,氛围酷炫、年轻,适合科技、设计、社区类站点。页面中央是超大号渐变描边「404」数字,配合飞走的飞船 emoji,把错误提示做得轻松有趣。
设计亮点在于情绪安抚与引导并重:除大数字外,提供了搜索框供用户就地查找内容,并给出「返回首页 / 站点地图 / 联系我们」三个清晰出口,避免用户因迷路而直接离开;底部错误代码提示增强专业感。整页利用径向渐变光晕营造空间层次,纯 CSS 实现,无图片依赖。
适合任何希望在访客走丢时保留体验的网站。将其命名为 404.html 并配置到服务器的错误页,即可在链接失效时优雅兜底,降低跳出率。

使用教程
1. 下载与保存
将下方 HTML 源码全部复制,保存为 index.html 文件(注意文件后缀必须是 .html)。
2. 本地预览
直接双击 index.html 文件,浏览器会自动打开并渲染页面效果。也可以在文件夹内运行 python -m http.server 后访问 localhost:8000 进行预览。
3. 自定义修改
替换文字:直接编辑 HTML 中的标题、段落文本与链接。调整配色:修改 <style> 标签内的 CSS 变量(:root 部分)或具体颜色值。更换图片:将 <img> 的 src 属性换成你自己的图片地址,或将背景渐变替换为 background-image。
4. 上线部署
将 index.html 上传到任意支持静态网页托管的服务(GitHub Pages、Vercel、Netlify、阿里云 OSS、腾讯云 COS 等)即可获得独立访问网址。
HTML 源码
复制下方完整代码,保存为 .html 文件即可在浏览器中预览使用。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面走丢了 · 404</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { --neon: #a855f7; --neon2: #22d3ee; --bg: #0b1020; --muted: #8b93b0; }
body {
font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
color: #eef1ff; background: var(--bg); min-height: 100vh;
display: flex; align-items: center; justify-content: center;
background-image: radial-gradient(900px 400px at 20% 10%, rgba(168,85,247,.18), transparent),
radial-gradient(700px 400px at 85% 90%, rgba(34,211,238,.15), transparent);
}
.box { text-align: center; padding: 40px 24px; max-width: 560px; }
.code { font-size: 150px; font-weight: 900; line-height: 1; letter-spacing: -4px;
background: linear-gradient(135deg, var(--neon), var(--neon2)); -webkit-background-clip: text; background-clip: text; color: transparent;
filter: drop-shadow(0 8px 30px rgba(168,85,247,.4)); }
.emoji { font-size: 46px; margin-bottom: 6px; }
h1 { font-size: 26px; margin: 10px 0 12px; }
p { color: var(--muted); margin-bottom: 26px; font-size: 15px; }
.search { display: flex; gap: 10px; margin: 0 auto 26px; max-width: 420px; }
.search input { flex: 1; padding: 12px 16px; border-radius: 12px; border: 1px solid #28304f; background: #131a31; color: #fff; font-size: 15px; }
.search input:focus { outline: none; border-color: var(--neon); }
.search button { padding: 0 20px; border: none; border-radius: 12px; background: linear-gradient(135deg, var(--neon), var(--neon2)); color: #fff; font-weight: 700; cursor: pointer; }
.links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.links a { padding: 12px 26px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px; }
.links .primary { background: #fff; color: #0b1020; }
.links .ghost { border: 1px solid #2b3454; color: #cfd6f5; }
.links a:hover { opacity: .88; }
.tip { margin-top: 30px; font-size: 13px; color: #5b6390; }
</style>
</head>
<body>
<div class="box">
<div class="emoji">🛸</div>
<div class="code">404</div>
<h1>哎呀,这个页面飞走了</h1>
<p>你访问的链接可能已删除、改名,或者从来就不存在。别担心,我们帮你找回方向。</p>
<div class="search">
<input type="text" placeholder="搜索你想找的内容…">
<button>搜索</button>
</div>
<div class="links">
<a href="/" class="primary">返回首页</a>
<a href="/sitemap" class="ghost">查看站点地图</a>
<a href="/contact" class="ghost">联系我们</a>
</div>
<p class="tip">错误代码:404 · 页面未找到 · 将于 5 秒后自动返回首页</p>
</div>
</body>
</html>
原创文章,作者:小蓝IT,如若转载,请注明出处:https://www.xiaolanzy.com/1856.html
微信扫一扫
支付宝扫一扫