第一步:先创建基本框架
<!DOCTYPE html>
<html>
<head>
<title>404-对不起!您访问的页面不存在</title>
<meta charset="UTF-8" http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div class="container">
<div class="content">
<div class="title">404-对不起!您访问的页面不存在</div>
</div>
</div>
</body>
</html>
第二步,编写代码样式
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 42px;
margin-bottom: 40px;
}
最后,实现完整代码:
<!DOCTYPE html>
<html>
<head>
<title>404-对不起!您访问的页面不存在</title>
<meta charset="UTF-8" http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container {
text-align: center;
display: table-cell;
vertical-align: middle;
}
.content {
text-align: center;
display: inline-block;
}
.title {
font-size: 42px;
margin-bottom: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<div class="title">404-对不起!您访问的页面不存在</div>
</div>
</div>
</body>
</html>
网友评论