欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

404页面实现

程序员文章站 2024-03-22 22:57:10
...

 页面代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>页面丢失了</title>
		<link rel="stylesheet" type="text/css" href="lib/css/404plane.css"/>
	</head>
	<body>
		<div class="error">
			<div class="sky">
				<h2>
					<span>4</span>
					<span>0</span>
					<span>4</span>
				</h2>
				<div class="grass"></div>
				<img src="lib/image/plane.jpg" class="plane">
			</div>
			<div class="field">
				<h2>啊哦,页面走丢了</h2>
				<a href="#">返回首页</a>
			</div>
		</div>
	</body>
</html>

 样式代码:

*
{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: consolas;
}
.error{
	min-height: 100vh;
	background: linear-gradient(0deg,#fff,#03a9f4);
}
.sky{
	position: relative;
	widows: 100%;
	height: 60vh;
	display: flex;
	justify-content: center;
	align-items: center;
}
.sky h2{
	font-size: 12em;
	color: #fff;
	text-shadow: 15px 15px 0 rgba(0,0,0,0.1);
}
.sky h2 span{
	margin: 0;
	padding: 0;
	display: inline-block;
	animation: animate 2s ease-in-out infinite;
}
.sky h2 span:nth-child(even){
	animation-delay: -1s;
}
@keyframes animate{
	0%,100%
	{
		transform: translateY(-50px);
	}
	50%
	{
		transform: translateY(50px);
	}
}

.field{
	padding: 100px;
	height: 40vh;
	background: #6e2308;
	box-shadow: inset 0 20px 10px #51680c;
	text-align: center;
}
.field h2{
	color: #fff;
	font-size: 2em;
	font-family: 宋体;
	margin-bottom: 20px;
}
.field a{
	background: #fff;
	color: #000;
	width: 160px;
	height: 50px;
	line-height: 50px;
	border-radius: 50px;
	display: inline-block;
	text-decoration: none;
	font-size: 20px;
}
.plane{
	position: absolute;
	bottom: 200px;
	left: 100px;
	max-width: 300px;
}

 

其中自己百度一张飞机的图片,然后自己添加进文件里面,要注意路径问题。

效果如下图:

404页面实现