This website is the best viewed in bigger devices.

How To Design - 404 Page


Learn how to create a Cool 404 Page with HTML5, CSS3, and JavaScript


404 Page

How To Create a 404 Page

Step 1) Add HTML

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>404 Page</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="images/favicon.png" type="image/png" sizes="16x16">
    <link href="https://fonts.googleapis.com/css?family=Poppins:300,400,600,700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="css/style.css">
</head>

<body>

    <div id="container">
      <div class="content">
          <h2>404</h2>
          <h4>Oops! Page Not Found</h4>
          <p>The Page you were looking for doesn't exist. You may have mistyped the address or the page may have moved.</p>
          <a href="#">Back to Home</a>
      </div>
    </div>
    
</body>

</html>

Step 2) Add CSS:

Download the background image which is used in this project.

/*

This is a 404 Page with HTML, CSS, and JavaScript. You can freely use it in your project.
Online Tutorials inspired us to make it. It is made with ♥ by Learn Computer Academy. 
Visit our website: www.learncomputer.in

*/

/* Normalization */

*,
*::before,
*::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    background: linear-gradient(45deg, #8500ff, #5acaff);
}

#container {
    position: absolute;
    top: 10%;
    left: 10%;
    right: 10%;
    bottom: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('p404.png'), #151729;
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, .5);
}

#container .content {
    max-width: 600px;
    text-align: center;
}

#container .content h2 {
    font-size: 18vw;
    color: #fff;
    line-height: 1em;
}

#container .content h4 {
    position: relative;
    font-size: 1.5em;
    color: #111;
    background: #fff;
    font-weight: 300;
    padding: 10px 20px;
    display: inline-block;
}

#container .content p {
    font-size: 1.2em;
    color: #fff;
    margin: 20px 0 20px 0;
}

#container .content a {
    position: relative;
    display: inline-block;
    padding: 14px 25px 10px;
    background: #ff0562;
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
}

#container .content a::after {
    content: '';
    position: absolute;
    right: 0;
    left: 0;
    top: 2px;
    width: 60%;
    height: 10px;
    border-radius: 20px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, .15);
}

Step 3) Add JavaScript:

<script>

  var container = document.getElementById("container");
  window.onmousemove = function(e) {
      var x = -e.clientX / 15;
      var y = -e.clientY / 15;

      container.style.backgroundPositionX = x + 'px';
      container.style.backgroundPositionY = y + 'px';

  }
</script>