<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Light/Dark Mode Toggle</title>
<style>
body {
font-family: Arial, sans-serif;
transition: background-color 0.4s, color 0.4s;
text-align: center;
padding: 50px;
}
body.light-mode {
background-color: #ffffff;
color: #000000;
}
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
button {
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 8px;
cursor: pointer;
background-color: #007BFF;
color: white;
transition: background-color 0.3s;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body class="light-mode">
<h1>Website Front Mode</h1>
<p>Click the button to switch between Light and Dark Mode.</p>
<button onclick="toggleMode()">Toggle Mode</button>
<script>
function toggleMode() {
document.body.classList.toggle("dark-mode");
document.body.classList.toggle(
"light-mode");
}
</script>
</body>
</html>
Comments
Post a Comment