Alright, let’s give each number its own little spotlight with individual squares! Here’s how you can achieve that:
<div id="countdown" class="flex justify-center space-x-12 text-center p-4 bg-gray-800 text-white rounded-lg shadow-lg">
<div class="flex flex-col items-center space-y-4">
<span id="days" class="text-5xl font-extrabold bg-gray-700 p-4 rounded-md"></span>
<div class="text-lg mt-2 bg-red-500 p-2 rounded-md">Days</div>
</div>
<div class="flex flex-col items-center space-y-4">
<span id="hours" class="text-5xl font-extrabold bg-gray-700 p-4 rounded-md"></span>
<div class="text-lg mt-2 bg-blue-500 p-2 rounded-md">Hours</div>
</div>
<div class="flex flex-col items-center space-y-4">
<span id="minutes" class="text-5xl font-extrabold bg-gray-700 p-4 rounded-md"></span>
<div class="text-lg mt-2 bg-green-500 p-2 rounded-md">Minutes</div>
</div>
<div class="flex flex-col items-center space-y-4">
<span id="seconds" class="text-5xl font-extrabold bg-gray-700 p-4 rounded-md"></span>
<div class="text-lg mt-2 bg-yellow-500 p-2 rounded-md">Seconds</div>
</div>
</div>
<script>
const countdownDate = new Date("Dec 31, 2026 23:59:59").getTime();
const countdownFunction = setInterval(() => {
const now = new Date().getTime();
const distance = countdownDate - now;
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById("days").innerText = days;
document.getElementById("hours").innerText = hours;
document.getElementById("minutes").innerText = minutes;
document.getElementById("seconds").innerText = seconds;
if (distance < 0) {
clearInterval(countdownFunction);
document.getElementById("countdown").innerHTML = "EXPIRED";
}
}, 1000);
</script>
Each number now has its own square with a background color. You can tweak the colors and sizes to fit your style. Let me know if this squares things up nicely! ![]()
![]()