DEV Community

Cover image for How to create a 404 error page in Html
Stackfindover
Stackfindover

Posted on • Updated on

How to create a 404 error page in Html

Hello, guys in this tutorial we will create a 404 Error Page Design using HTML & CSS

Common Query

  1. How to create a 404 Error Page
  2. how to create a 404 error page in HTML
  3. How to create a 404 Error Awesome Page Design

Hello, guys In this tutorial we will try to solve above mention query. and also we will learn how to create a 404 Error Page using HTML & CSS

Step:1

Add below code inside index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>404 Error Page</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <link rel="stylesheet" href="style.css" />
  <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@500&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
  <div class="wrapper">
    <div class="container">
      <div class="grid-row">
        <div class="colmun colmun-left">
          <img src="image-left.png" alt="image-left">
          <h1 class="px-spc-b-20">We can't find the page you are looking for.</h1>
          <span class="px-spc-b-20">This page has been relocated or removed.</span>

          <button class="go-home"><i class="fa fa-home"></i> Go Home</button>
        </div>
        <div class="colmun colmun-right">
          <img src="right-shape.png" alt="right-shape">
        </div>
      </div>
    </div>
  </div>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Step:2

Then we need to add code for style.css which code I provide in the below screen.

* {
  padding: 0;
  margin: 0;
  outline: 0;
  color: #444;
  box-sizing: border-box;
  font-family: 'IBM Plex Sans', sans-serif;
}
body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}
h1 {
  font-size: 50px;
  line-height: 60px;
}
span {
  display: block;
  font-size: 18px;
  line-height: 30px;
}
.container {
  width: 80%;
  max-width: 1600px;
  margin: auto;
}
.grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  place-items: center;
  grid-gap: 50px;
}
.colmun-left {
  text-align: left;
}
.colmun-right {
  text-align: right;
}
.px-spc-b-20 {
  padding-bottom: 20px;
}
button.go-home {
  padding: 5px 20px;
  background: #ffa000;
  border: transparent;
  border-radius: 2px;
  box-shadow: 0 0 2px rgb(0 0 0 / 30%);
  cursor: pointer;
  margin: 20px 0;
  color: #fff;
}
button.go-home i {
  color: #fff;
}
img {
  display: block;
  width: 100%;
}
Enter fullscreen mode Exit fullscreen mode

404 error page design video output:

Top comments (0)