404错误页面制作

404错误页面

在这里插入图片描述

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/index.css">
    <title>404错误页面</title>
    
</head>
    <body>
     <div class="error-page">
         <div class="content">
                <h1 data-text="404">404</h1>
                <h4 data-text="OPPS! Page not found! ">Opps! Page not found!</h4>
                <p>sorry, the page you're looking for doesn't exist. if you think something is broken, report a problem.</p>
                <div class="btns">
                 <a href="#">return home</a>
                 <a href="#">report problem</a>
                </div>
         </div>
      </div>
    </body>
    

css部分

 1. {
        padding: 0;
        margin: 0;
        outline: none;
        /* outine none去掉元素周围边框 */
        box-sizing: border-box;
        /* 把元素的内边距和边框都塞到盒子里,不让盒子变形 */
        font-family: 'Poppins', sans-serif;
        /* 两种都是非衬线字体,特点机械统一线条
        正文内通常使用serif字体,标题表格内采用醒目的sansserif  */
    }
    body {
        background: -webkit-repeating-linear-gradient(-45deg, #71b7e6, #69a6ce, #b98acc, #ee8176, #b98acc, #69a6ce, #9b59b6);
        /* css重复渐变背景 */
        height: 100vh;
        background-size: 200;
    }
     .error-page {
        position: absolute;
        /* 针对父级元素 */
        top: 10%;
        left: 17%;
        right: 17%;
        bottom: 20%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        box-shadow: 0px 5px 10px rgba(0, 0, 0, 1);
    }
      .error-page .content {  
        max-width: 600px;  
        text-align: center;
      }
      .content h1 {  
        font-size: 18vw;  
        line-height: 1em;  
        position: relative;
      }
      .content h1:after {  
        position: absolute;  
        content: attr(data-text);  
        top: 0;  
        left: 0;  
        right: 0;  
        background: -webkit-repeating-linear-gradient(-45deg, #71b7e6, #69a6ce, #b98acc, #ee8176, #b98acc, #69a6ac, #9b59b6);
        background-size: 400%;  
        -webkit-background-clip: text;  
        background-clip: text;  
        -webkit-text-fill-color: transparent;  
        text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.25);  
        animation: animate 10s ease-in-out infinite;
      }
      @keyframes animate {  
        0% {     
         background-position: 0 0;  
        }   
        25% {    
         background-position: 100% 0;  
        }  
        50% {    
         background-position: 100% 100%;  
        }  
        75% {    
         background-position: 0 100%;  
        }  
        100% {   
         background-position: 0 0;  
        }  
        }
      .content h4 {  
        margin-bottom: 20px;  
        text-transform: uppercase;  
        color: #000;  
        max-width: 600px;  
        font-size: 2em;  
        position: relative;
      }
      .content h4:after {  
        position: absolute;   
        content: attr(data-text);  
        top: 0;   
        left: 0;  
        right: 0;  
        text-shadow: 1px 1px 2px rgba(225, 225, 255,0.4);   
        -webkit-background-clip-: text;   
        background-clip: text;  
        -webkit-text-fill-color: transparent;
      }
      .content p {  
        font-size: 1.2em;  
        color: #0d0d0d;
      }
      .content .btns {  
        margin: 25px 0;  
        display: inline-flex;
      }
      .content .btns  a {  
        display: inline-block;  
        margin: 0 10px;  
        text-decoration: none;  
        border: 2px solid #69a6ce;  
        color: #69a6ce;  
        font-weight: 500;  
        padding: 10px 25px;  
        border-radius: 25px;  
        text-transform: uppercase;  
        transition: all 0.3s ease;
      }
      .content .btns  a:hover {  
        color: #fff;  
        background: #69a6ce;
      }

注意事项以及没遇到过的样式

  1. *{} 通配符选择器,选中页面中所有标签自动给所有元素加样式 删除默认元素的内外边距影响
  2. margin: 0和padding: 0指所有标签的默认内外边距都为0,防止接下来移动位置有偏差
  3. 字体类型:poppins ,sans-serif为艺术性创意字体 为非衬线字体
  4. box-sizing:border-box 把元素的内外边距塞到盒子里 不让盒子变形。
  5. position:absolute子元素相对于父级元素body上下左右分别移动四个百分比数字
  6. 给父相添加flex属性以后align-items center子元素沿着侧轴排列这里的侧轴指y轴 justify-content center子元素沿着主轴x轴排列 即父元素里的子元素全部垂直居中
  7. box shadow设置盒子外面的阴影
  8. max-width和width即父元素宽度比较 哪个显示哪个
  9. text-align :center content内块级元素 行内快元素 行内元素内文本都居中
  10. h1的伪类绝对定位是根据父级元素h1 相对定位
  11. content:attr 不把内容在css里写死 从页面中获取动态内容 在这个页面中闪烁的404就是指动态内容
  12. 属性 animation 属性值ease-in-out动画以低速开始和结束 属性值animate必需的 定义animation名称
  13. text-fill-color设置所有元素的颜色 如果有color前者覆盖后者
  14. text-transform:uppercase单词转化成大写
  15. background-clip文字透明效果
  16. display :inline-block行内元素转化为行内块元素 可以设置宽高
  17. @keyframes用来改变动画的轨迹和效果 百分之多少分别表示动画运行到一部分时的背景图位置
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值