Countdown Timer
Countdown Timer
Countdown Timer
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Event Day Countdown</title>
<style>
body {
text-align: center;
font-family: Arial, sans-serif;
color: white; /* Sets the text color to white */
}
#timer {
font-size: 36px;
font-weight: bold;
display: inline-block;
}
.time-unit {
background-color: rgba(80, 80, 80, 0.5); /* Slightly transparent background */
margin: 5px;
display: inline-block;
width: 100px; /* Width of each box */
padding: 10px;
border-radius: 5px; /* Rounded corners for the boxes */
}
.time-unit span {
color: white; /* Text color inside the box */
}
.label {
display: block;
font-size: 0.8em;
}
</style>
</head>
<body>
<div id="countdownTimer">
<p></p>
<div id="timer">
<div class="time-unit"><span id="days">00</span><span class="label">Days</span></div>
<div class="time-unit"><span id="hours">00</span><span class="label">Hours</span></div>
<div class="time-unit"><span id="minutes">00</span><span class="label">Min</span></div>
<div class="time-unit"><span id="seconds">00</span><span class="label">Sec</span></div>
<!-- Removing milliseconds for consistency with your input -->
</div>
</div>
<script>
// Set the date we're counting down to (8th February 2024)
let countdownDate = new Date("Feb 8, 2024 17:00:00").getTime();
function updateCountdown() {
let now = new Date().getTime();
let distance = countdownDate - now;
if (distance < 0) {
clearInterval(interval);
document.getElementById("timer").innerHTML = "EXPIRED";
}
}
</body>
</html>