Countdown Timer Counter - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Countdown Timer Counter</title> <style> body { display: flex; justify-content: center; align-items: center; height: 100vh; background: linear-gradient(135deg, #00c9ff, #92fe9d); font-family: 'Arial', sans-serif; margin: 0; } .counter-container { text-align: center; background: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1); position: relative; } .counter { font-size: 100px; color: #333; margin: 0; } .label { font-size: 20px; color: #333; margin-top: 10px; letter-spacing: 1.5px; } .increment-btn { background: #00c9ff; color: #fff; border: none; padding: 10px 20px; font-size: 20px; border-radius: 5px; cursor: pointer; margin-top: 20px; transition: background 0.3s; } .increment-btn:hover { background: #92fe9d; } </style> </head> <body> <div class="counter-container"> <div class="counter" id="counter">10</div> <div class="label">Countdown</div> <button class="increment-btn" onclick="startCountdown()">Start Countdown</button> </div> <script> let count = 10; const counterElement = document.getElementById('counter'); function startCountdown() { const countdownInterval = setInterval(() => { if (count > 0) { count--; counterElement.textContent = count; } else { clearInterval(countdownInterval); alert('Time\'s up!'); } }, 1000); } </script> </body> </html>