Skip to content

Commit a5a6d9e

Browse files
1046prtxkeshav
authored andcommitted
Add custom 404 error page with styling and content updates
1 parent 24268e3 commit a5a6d9e

File tree

2 files changed

+160
-5
lines changed

2 files changed

+160
-5
lines changed

src/assets/styles/404.css

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
.error-container {
2+
min-height: 100vh;
3+
background: light-dark(#f8fafc, #0f172a);
4+
display: flex;
5+
align-items: center;
6+
justify-content: center;
7+
padding: 2rem;
8+
position: relative;
9+
overflow: hidden;
10+
}
11+
12+
.error-container::before {
13+
content: '';
14+
position: absolute;
15+
inset: 0;
16+
background:
17+
radial-gradient(circle at 20% 30%, light-dark(#3b82f6, #ffffff) 1px, transparent 1px),
18+
radial-gradient(circle at 80% 70%, light-dark(#3b82f6, #ffffff) 1px, transparent 1px);
19+
background-size: 100px 100px;
20+
animation: sparkle 3s linear infinite;
21+
}
22+
23+
@keyframes sparkle {
24+
0%,
25+
100% {
26+
opacity: 0.3;
27+
transform: translateY(0);
28+
}
29+
50% {
30+
opacity: 0.8;
31+
transform: translateY(-10px);
32+
}
33+
}
34+
35+
.content {
36+
text-align: center;
37+
z-index: 1;
38+
position: relative;
39+
}
40+
41+
.error-number {
42+
font-size: 8rem;
43+
font-weight: 900;
44+
color: #3b82f6;
45+
text-shadow: 0 0 15px #3b82f6;
46+
animation: pulse 2s ease-in-out infinite;
47+
margin-bottom: 1rem;
48+
}
49+
50+
@keyframes pulse {
51+
0%,
52+
100% {
53+
transform: scale(1);
54+
}
55+
50% {
56+
transform: scale(1.05);
57+
}
58+
}
59+
60+
.title {
61+
font-size: 2.5rem;
62+
font-weight: 800;
63+
color: light-dark(#1e293b, #ffffff);
64+
margin: 0 0 1rem 0;
65+
letter-spacing: 0.1em;
66+
}
67+
68+
.subtitle {
69+
font-size: 1.25rem;
70+
color: light-dark(#64748b, #cbd5e1);
71+
margin-bottom: 1rem;
72+
}
73+
74+
.tip {
75+
font-size: 1.1rem;
76+
color: light-dark(#475569, #e2e8f0);
77+
margin-bottom: 2rem;
78+
}
79+
80+
.error-illustration {
81+
width: 200px;
82+
height: auto;
83+
margin: 1rem auto;
84+
display: block;
85+
}
86+
87+
.buttons {
88+
display: flex;
89+
gap: 1rem;
90+
justify-content: center;
91+
flex-wrap: wrap;
92+
}
93+
94+
.btn {
95+
padding: 1rem 2rem;
96+
border-radius: 8px;
97+
font-size: 1.1rem;
98+
font-weight: 600;
99+
text-decoration: none;
100+
border: none;
101+
cursor: pointer;
102+
transition: all 0.3s ease;
103+
display: inline-flex;
104+
align-items: center;
105+
gap: 0.5rem;
106+
}
107+
108+
.primary {
109+
background: #3b82f6;
110+
color: white;
111+
box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
112+
}
113+
114+
.primary:hover {
115+
background: #2563eb;
116+
transform: translateY(-2px);
117+
}
118+
119+
.secondary {
120+
background: #e0f2fe;
121+
color: #0c4a6e;
122+
border: 2px solid #0ea5e9;
123+
}
124+
125+
.secondary:hover {
126+
background: #bae6fd;
127+
transform: translateY(-2px);
128+
}
129+
130+
@media (max-width: 768px) {
131+
.error-number {
132+
font-size: 6rem;
133+
}
134+
.title {
135+
font-size: 2rem;
136+
}
137+
.buttons {
138+
flex-direction: column;
139+
align-items: center;
140+
}
141+
.btn {
142+
width: 180px;
143+
}
144+
.error-illustration {
145+
width: 150px;
146+
}
147+
}

src/pages/404.astro

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
---
22
import BaseLayout from "@/layouts/Base";
3+
import "@/assets/styles/404.css";
34
45
const meta = {
5-
title: "Oops! You found a missing page!",
6-
description: "Oops! It looks like this page is lost in space!"
6+
title: "Yikes! This Page Is Somewhere Beyond the Milky Way ✨",
7+
description: "Looks like this page took a wrong turn! Let's guide you back to learning."
78
};
89
---
9-
1010
<BaseLayout meta={meta}>
11-
<h1 class="title mb-6">404 | Oops something went wrong</h1>
12-
<p class="mb-8">Please use the navigation to find your way back</p>
11+
<div class="error-container">
12+
<div class="content">
13+
<div class="error-number">404</div>
14+
<h1 class="title">Oops! You're Lost in Space 🚀</h1>
15+
<p class="tip">Don't worry, Cadet! Let's fly back and keep learning.</p>
16+
<div class="buttons">
17+
<a href="/" class="btn primary">🏠 Home</a>
18+
</div>
19+
</div>
20+
</div>
1321
</BaseLayout>

0 commit comments

Comments
 (0)