分享大家一个好看的 404 Page 代码


演示图


代码演示

<!--
Developer: @Arvin
Explain: 404 Page
-->
<!DOCTYPE html>
<html lang="zh-CN">

<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<title>休息一下吧<(  ̄^ ̄)</title>
<style type="text/css">
:root {
--background-color: #2c3e50;
--border-color: #7591AD;
--text-color: #34495e;
--color1: #EC3E27;
--color2: #FD79A8;
--color3: #0984E3;
--color4: #00B894;
--color5: #FDCB6E;
--color6: #E056FD;
--color7: #F97F51;
--color8: #BDC581;
}

* {
margin: 0;
padding: 0;
}

html {font-size: 14px;}

body {
width: 100vw;
height: 100vh;
background-color: var(--background-color);
background-image: linear-gradient(to right bottom, var(--color_left), var(--color_leftcolor_right));
display: flex;
justify-content: center;
align-items: center;
font-family: 'Montserrat', sans-serif, Arial, 'Microsoft Yahei';
}

.channel{
position: absolute;
width: 80%;
text-align: center;
top: 50%;
left: 50%;
transform: translate(-50%, -200px);
font-size: 30px;
font-weight: bold;
color: #fff;
}

.container{
width: 600px;
display: flex;
justify-content: space-between;
align-items: center;
}

.container span{
display: inline-block;
width: 200px;
font-size: 240px;
/*background-color: #ff5f99;*/
text-align: center;
font-weight: 800;
font-family: arial, helvetica, sans-serif;

}

.container span.middle{
position: relative;
width: 200px;
height: 200px;
/*background-color: #d0ffc6;*/
}

.container span.middle::before,
.container span.middle::after{
position: absolute;
content: '';
width: 200px;
height: 200px;
top: 0;
left: 0;
/*background-color: #ffbd98;*/

/* 效果实现: 内阴影 透明度66(十六进制) <左上右下> @Arvin */
box-shadow:
inset 30px 0 0 #FD79A866,
inset 0 30px 0 #0984E366,
inset -30px 0 0 #EC3E2766,
inset 0 -30px 0 #D0FFc666;
border-radius: 50%;
animation: animate_before 5s linear infinite;
}

.container span.middle::after{
transform: rotate(-45deg);
}

/* 动画效果: 分成四次顺时针切换四个阴影颜色 @Arvin */
@keyframes animate_before{
0%{
box-shadow:
inset 30px 0 0 #FD79A866,
inset 0 30px 0 #0984E366,
inset -30px 0 0 #EC3E2766,
inset 0 -30px 0 #D0FFc666;
}
25%{
box-shadow:
inset 30px 0 0 #0984E366,
inset 0 30px 0 #EC3E2766,
inset -30px 0 0 #D0FFc666,
inset 0 -30px 0 #FD79A866;
}
50%{
box-shadow:
inset 30px 0 0 #EC3E2766,
inset 0 30px 0 #D0FFc666,
inset -30px 0 0 #FD79A866,
inset 0 -30px 0 #0984E366;
}
75%{
box-shadow:
inset 30px 0 0 #D0FFc666,
inset 0 30px 0 #FD79A866,
inset -30px 0 0 #0984E366,
inset 0 -30px 0 #EC3E2766;
}
100%{
box-shadow:
inset 30px 0 0 #FD79A866,
inset 0 30px 0 #0984E366,
inset -30px 0 0 #EC3E2766,
inset 0 -30px 0 #D0FFc666;
}
}

/* 左侧文字效果:分四次将当前文字颜色变换为 左侧内阴影的颜色 @Arvin */
.container span:nth-child(1){
animation: animate_span_1 5s linear infinite;
}

/*动画 @Arvin */
@keyframes animate_span_1{
0%{
color: #FD79A866;
}
25%{
color: #0984E366
}
50%{
color: #EC3E2766;
}
75%{
color: #D0FFc666
}
100%{
color: #FD79A866;
}
}

/* 右侧文字效果:分四次将当前文字颜色变换为 右侧内阴影的颜色 @Arvin */
.container span:nth-child(3){
animation: animate_span_3 5s linear infinite;
}

/*动画 @Arvin */
@keyframes animate_span_3{
0%{
color: #FD79A866;
}
25%{
color: #D0FFc666;
}
50%{
color: #EC3E2766;
}
75%{
color: #0984E366;
}
100%{
color: #FD79A866;
}
}
</style>
</head>

<body>

<div class="channel">
TCT 代码中遇见二次元 🤍
</div>

<div class="container">
<span>4</span>
<span class="middle"></span>
<span>4</span>
</div>

</body>

</html>