Refactor 404 page layout and styles for improved responsiveness and dark mode support
This commit is contained in:
1 parent
f42a879bf1
commit
d01eaf5cbd
1 file changed
+99
-46
@@ -1,4 +1,3 @@
|
||||
<div id="fps-counter"></div>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -6,31 +5,113 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>404 Not Found</title>
|
||||
<style>
|
||||
:root {
|
||||
/* Light mode colors */
|
||||
--background-light: #f8f9fa;
|
||||
--text-light: #343a40;
|
||||
--accent-light: #007bff;
|
||||
|
||||
/* Dark mode colors */
|
||||
--background-dark: #121212;
|
||||
--text-dark: #f8f9fa;
|
||||
--accent-dark: #0d6efd;
|
||||
|
||||
/* Shared colors */
|
||||
--error-color: #dc3545;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f8f9fa;
|
||||
color: #343a40;
|
||||
text-align: center;
|
||||
padding: 50px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
background-color: var(--background-light);
|
||||
color: var(--text-light);
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
}
|
||||
|
||||
body.dark-mode {
|
||||
background-color: var(--background-dark);
|
||||
color: var(--text-dark);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 60px;
|
||||
color: #dc3545;
|
||||
color: var(--error-color);
|
||||
animation: fadeIn 1s ease-out;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 20px;
|
||||
margin: 10px 0;
|
||||
animation: slideUp 1s ease-out;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #007bff;
|
||||
color: var(--accent-light);
|
||||
font-weight: bold;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
body.dark-mode a {
|
||||
color: var(--accent-dark);
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 300px;
|
||||
margin-top: 20px;
|
||||
animation: bounce 2s infinite;
|
||||
}
|
||||
|
||||
#fps-counter {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
z-index: 1000; /* Ensure it stays on top */
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
transform: translateY(20px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bounce {
|
||||
0%, 100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -38,47 +119,19 @@
|
||||
<h1>404 Not Found</h1>
|
||||
<p>Oops! The page you are looking for does not exist.</p>
|
||||
<p>It might have been removed, had its name changed, or is temporarily unavailable.</p>
|
||||
|
||||
<p>Please <a href="/">return to the homepage</a> or use the navigation menu to find what you need.</p>
|
||||
|
||||
<img src="404.gif" alt="404">
|
||||
<img src="404.gif" alt="404">
|
||||
<p>If you believe this is an error, please <a href="/Contact.html">contact us</a>.</p>
|
||||
</body>
|
||||
</html>
|
||||
<style>
|
||||
#fps-counter {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
z-index: 1000; /* Ensure it stays on top */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
const fpsCounter = document.getElementById("fps-counter"); // Moved this to the correct place
|
||||
|
||||
function calculateFPS() {
|
||||
let lastFrameTime = performance.now();
|
||||
let frames = 0;
|
||||
|
||||
function frameLoop() {
|
||||
const now = performance.now();
|
||||
frames++;
|
||||
|
||||
if (now - lastFrameTime >= 1000) {
|
||||
const fps = Math.round(frames / ((now - lastFrameTime) / 1000));
|
||||
fpsCounter.textContent = `FPS: ${fps}`;
|
||||
frames = 0;
|
||||
lastFrameTime = now;
|
||||
}
|
||||
requestAnimationFrame(frameLoop);
|
||||
<script>
|
||||
// Apply dark mode based on localStorage
|
||||
function applyDarkMode() {
|
||||
const isDarkMode = localStorage.getItem('darkMode') === 'true';
|
||||
document.body.classList.toggle('dark-mode', isDarkMode);
|
||||
}
|
||||
frameLoop();
|
||||
}
|
||||
|
||||
calculateFPS(); // Ensure the FPS calculation starts
|
||||
</script>
|
||||
// Initialize dark mode on page load
|
||||
window.onload = applyDarkMode;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user