Countdown Timer
A live HH:MM:SS countdown in styled time blocks.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div class="card border-0 shadow-sm text-center" style="max-width:320px"><div class="card-body">
<h6 class="fw-bold mb-2">Offer ends in</h6>
<div class="d-flex justify-content-center gap-2">
<div class="bg-dark text-white rounded p-2" style="min-width:54px"><div class="h4 mb-0" id="cdH">00</div><small>hrs</small></div>
<div class="bg-dark text-white rounded p-2" style="min-width:54px"><div class="h4 mb-0" id="cdM">00</div><small>min</small></div>
<div class="bg-dark text-white rounded p-2" style="min-width:54px"><div class="h4 mb-0" id="cdS">00</div><small>sec</small></div>
</div>
</div></div>var end=Date.now()+(2*3600+30*60)*1000;
function p(n){return String(n).padStart(2,'0')}
function tick(){var d=Math.max(0,Math.floor((end-Date.now())/1000));document.getElementById('cdH').textContent=p(Math.floor(d/3600));document.getElementById('cdM').textContent=p(Math.floor(d%3600/60));document.getElementById('cdS').textContent=p(d%60)}
tick();setInterval(tick,1000);Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.