写一个好看有趣的404网页
- User
写一个好看有趣的404网页
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
写一个好看有趣的404网页
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
我来为你创建一个有趣且美观的404页面:
<!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;
}
body {
font-family: 'Microsoft YaHei', Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.container {
text-align: center;
color: white;
position: relative;
z-index: 10;
}
.error-code {
font-size: 8rem;
font-weight: bold;
margin-bottom: 1rem;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
animation: bounce 2s infinite;
}
.error-message {
font-size: 1.5rem;
margin-bottom: 2rem;
opacity: 0.9;
}
.search-container {
margin: 2rem 0;
}
.search-box {
padding: 1rem 1.5rem;
font-size: 1rem;
border: none;
border-radius: 50px;
outline: none;
width: 300px;
max-width: 90vw;
margin-right: 1rem;
}
.btn {
padding: 1rem 2rem;
font-size: 1rem;
border: none;
border-radius: 50px;
cursor: pointer;
transition: all 0.3s ease;
text-decoration: none;
display: inline-block;
margin: 0.5rem;
}
.btn-primary {
background: #ff6b6b;
color: white;
}
.btn-secondary {
background: rgba(255,255,255,0.2);
color: white;
border: 2px solid white;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.astronaut {
position: absolute;
top: 20%;
right: 10%;
font-size: 4rem;
animation: float 3s ease-in-out infinite;
}
.planet {
position: absolute;
width: 60px;
height: 60px;
border-radius: 50%;
animation: rotate 20s linear infinite;
}
.planet1 {
background: #ff9ff3;
top: 15%;
left: 15%;
animation-delay: -5s;
}
.planet2 {
background: #54a0ff;
bottom: 20%;
right: 25%;
width: 40px;
height: 40px;
animation-delay: -10s;
}
.planet3 {
background: #5f27cd;
top: 60%;
left: 10%;
width: 30px;
height: 30px;
animation-delay: -15s;
}
.stars {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
}
.star {
position: absolute;
background: white;
border-radius: 50%;
animation: twinkle 2s infinite;
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-10px);
}
60% {
transform: translateY(-5px);
}
}
@keyframes float {
0% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
100% {
transform: translateY(0px);
}
}
@keyframes rotate {
0% {
transform: translateY(0px) rotate(0deg);
}
50% {
transform: translateY(-10px) rotate(180deg);
}
100% {
transform: translateY(0px) rotate(360deg);
}
}
@keyframes twinkle {
0%, 100% {
opacity: 0.3;
}
50% {
opacity: 1;
}
}
.fun-facts {
margin-top: 2rem;
padding: 1rem;
background: rgba(255,255,255,0.1);
border-radius: 15px;
backdrop-filter: blur(10px);
}
@media (max-width: 768px) {
.error-code {
font-size: 4rem;
}
.astronaut {
position: relative;
top: auto;
right: auto;
display: block;
margin: 1rem 0;
}
.search-box {
width: 250px;
margin-right: 0;
margin-bottom: 1rem;
}
}
</style>
</head>
<body>
<div class="stars" id="stars"></div>
<div class="planet planet1"></div>
<div class="planet planet2"></div>
<div class="planet planet3"></div>
<div class="astronaut">🚀</div>
<div class="container">
<div class="error-code">404</div>
<div class="error-message">哎呀!这个页面去宇宙旅行了</div>
<p>看起来你要找的页面正在探索银河系的其他角落</p>
<div class="search-container">
<input type="text" class="search-box" placeholder="搜索你想要的内容..." id="searchInput">
<button class="btn btn-primary" onclick="performSearch()">搜索</button>
</div>
<div>
<a href="/" class="btn btn-secondary">返回首页</a>
<a href="javascript:history.back()" class="btn btn-secondary">返回上页</a>
</div>
<div class="fun-facts">
<p id="funFact">💡 你知道吗?第一个404错误页面出现在1990年代的万维网早期</p>
</div>
</div>
<script>
// 创建星星背景
function createStars() {
const starsContainer = document.getElementById('stars');
for (let i = 0; i < 100; i++) {
const star = document.createElement('div');
star.className = 'star';
star.style.left = Math.random() * 100 + '%';
star.style.top = Math.random() * 100 + '%';
star.style.width = Math.random() * 3 + 1 + 'px';
star.style.height = star.style.width;
star.style.animationDelay = Math.random() * 2 + 's';
starsContainer.appendChild(star);
}
}
// 搜索功能
function performSearch() {
const searchTerm = document.getElementById('searchInput').value;
if (searchTerm.trim()) {
// 这里可以集成实际的搜索功能
window.location.href = `/search?q=${encodeURIComponent(searchTerm)}`;
}
}
// 回车键搜索
document.getElementById('searchInput').addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
performSearch();
}
});
// 有趣的事实轮播
const funFacts = [
'💡 你知道吗?第一个404错误页面出现在1990年代的万维网早期',
'🌟 404错误代码意思是"未找到",但页面设计可以很有创意',
'🚀 现在你在一个充满星星的宇宙中,虽然迷路了但很美丽',
'🎨 好的404页面可以将用户的沮丧转化为愉悦的体验',
'🔍 大约有25%的用户会在404页面上停留超过10秒钟'
];
let factIndex = 0;
setInterval(() => {
factIndex = (factIndex + 1) % funFacts.length;
document.getElementById('funFact').textContent = funFacts[factIndex];
}, 4000);
// 初始化
createStars();
// 添加鼠标移动效果
document.addEventListener('mousemove', (e) => {
const astronaut = document.querySelector('.astronaut');
const x = e.clientX / window.innerWidth;
const y = e.clientY / window.innerHeight;
astronaut.style.transform = `translate(${x * 20}px, ${y * 20}px)`;
});
</script>
</body>
</html>
这个404页面的特色包括:
视觉设计:
交互功能:
动画效果:
用户体验:
你可以根据需要调整颜色、动画速度或添加更多功能!