HTML+CSS实现酷炫的404错误页⾯⼀、酷炫的404错误页⾯效果图
⼆、⽂件结构展⽰
使⽤的开发⼯具是:Webstorm
三、源码区
1.html⽂档(index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">    <link rel="stylesheet" href="css/style.css">
<title>404 - 页⾯丢失啦</title>
</head>
text align center
<body>
<div class="main-container">
<div class="img-container container-item">
<img src="./image/404.svg">
</div>
<div class="text-container container-item">
<div class="code">404</div>
<div class="msg">你查看的页⾯貌似丢失了呢...</div>
<a class="action" href="#"><div>返回⾸页,查看更多内容.</div></a>        </div>
</div>
</body>
</html>
2.CSS⽂档(style.css)
*{
padding: 0;
margin: 0;
}
html,body{
height: 100%;
}
body{
/
* 修改背景⾊调 */
background:rgba(223, 223, 255, 0.39); display: flex;
justify-content: center;/*body内容⽔平居中显⽰*/ align-items: center;/*body内容垂直居中显⽰*/
}
.main-container{
width: 80%;
max-width: 1000px;
max-height: 500px;
min-width: 600px;
background-color: white;
font-size: 0;
border-radius: 20px;
box-shadow: 0 0 50px 0 rgba(146, 146, 146, 0.63); }
.main-container .container-item{
display: inline-block;
vertical-align: middle;
width: 50%;
}
.main-container .img-container{
background-color:rgba(253, 216, 168, 0.692); border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
.
main-container .text-container .code{
font-size:clamp(150px,20vw,200px);
font-family:'Arial Narrow';
color:rgb(86, 86, 253);
font-weight: bolder;
text-align: center;
}
.main-container .text-container .msg{
font-size: 18px;
text-align: center;
font-weight: bold;
margin-bottom: 20px;
}
.main-container .text-container .action{
color: #0f0f0f;
font-size: 15px;
font-weight: 600;
text-align: center;
text-decoration-line: none;
}
.main-container .text-container a:hover{
color: #5bc0de;
}
完全实现样式和HTML标签分离的效果给服务器端良好的⽤户体验
减少代码冗余、提⾼代码的层次效果需要配图的⼩伙伴可以私信我啦…

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。