cid1011 使用HTML CSS 创建一个404错误页面

index.html

  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <link rel="stylesheet" href="style.css">
  7. </head>
  8. <body>
  9. <div class="container">
  10. <h2>Oops! Page not found.</h2>
  11. <h1>404</h1>
  12. <p>We can't find the page you're looking for.</p>
  13. <a href="#">Go back home</a>
  14. </div>
  15. </body>
  16. </html>
<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <div class="container">
      <h2>Oops! Page not found.</h2>
      <h1>404</h1>
      <p>We can't find the page you're looking for.</p>
      <a href="#">Go back home</a>
    </div>
  </body>
</html>

style.css

  1. body{
  2. margin: 0;
  3. padding: 0;
  4. font-family: "montserrat",sans-serif;
  5. min-height: 100vh;
  6. background-image: linear-gradient(125deg,#6a89cc,#b8e994);
  7. }
  8. .container{
  9. width: 100%;
  10. position: absolute;
  11. top: 50%;
  12. transform: translateY(-50%);
  13. text-align: center;
  14. color: #343434
  15. }
  16. .container h1{
  17. font-size: 160px;
  18. margin: 0;
  19. font-weight: 900;
  20. letter-spacing: 20px;
  21. background: url(bg.jpg) center no-repeat;
  22. -webkit-text-fill-color: transparent;
  23. -webkit-background-clip: text;
  24. }
  25. .container a{
  26. text-decoration: none;
  27. background: #e55039aa;
  28. color: #fff;
  29. padding: 12px 24px;
  30. display: inline-block;
  31. border-radius: 25px;
  32. font-size: 14px;
  33. text-transform: uppercase;
  34. transition: 0.4s;
  35. }
  36. .container a:hover{
  37. background: #e55039;
  38. }
body{
  margin: 0;
  padding: 0;
  font-family: "montserrat",sans-serif;
  min-height: 100vh;
  background-image: linear-gradient(125deg,#6a89cc,#b8e994);
}

.container{
  width: 100%;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  color: #343434
}

.container h1{
  font-size: 160px;
  margin: 0;
  font-weight: 900;
  letter-spacing: 20px;
  background: url(bg.jpg) center no-repeat;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
}

.container a{
  text-decoration: none;
  background: #e55039aa;
  color: #fff;
  padding: 12px 24px;
  display: inline-block;
  border-radius: 25px;
  font-size: 14px;
  text-transform: uppercase;
  transition: 0.4s;
}

.container a:hover{
  background: #e55039;
}

让链接同时具备两种打开方式

获取源码: 404 Page
下载数:268人次, 文件大小: 0, 上传日期: 2020年-4 月-22日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

1,951 人查阅

类似文章