Retro Stopwatch - 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>Retro Stopwatch</title> <style> body { font-family: 'Courier New', monospace; background: linear-gradient(135deg, #ffcc70, #db7093); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; color: #333; } .stopwatch { background: #fff; border: 5px solid #333; border-radius: 10px; padding: 30px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); } .stopwatch .time { font-size: 3rem; margin-bottom: 20px; } .stopwatch .buttons { display: flex; justify-content: space-between; } .stopwatch button { background: #ff5733; border: none; border-radius: 5px; color: #fff; font-size: 1rem; padding: 10px 20px; cursor: pointer; transition: background 0.3s, transform 0.3s; } .stopwatch button:hover { background: #c70039; } .stopwatch button:active { transform: scale(0.95); } .stopwatch button:focus { outline: none; } </style> </head> <body> <div class="stopwatch"> <div class="time">00:00:00</div> <div class="buttons"> <button type="button" class="start-btn">Start ⏱️</button> <button type="button" class="reset-btn">Reset 🔄</button> </div> </div> <script> let timeDisplay = document.querySelector('.time'); let startBtn = document.querySelector('.start-btn'); let resetBtn = document.querySelector('.reset-btn'); let intervalId; let elapsedTime = 0; let running = false; startBtn.addEventListener('click', function() { if (!running) { intervalId = setInterval(() => { elapsedTime += 10; let date = new Date(elapsedTime); let minutes = String(date.getMinutes()).padStart(2, '0'); let seconds = String(date.getSeconds()).padStart(2, '0'); let milliseconds = String(date.getMilliseconds()).padStart(3, '0').slice(0, -1); timeDisplay.textContent = `${minutes}:${seconds}:${milliseconds}`; }, 10); running = true; startBtn.textContent = 'Pause ⏸️'; } else { clearInterval(intervalId); running = false; startBtn.textContent = 'Start ⏱️'; } }); resetBtn.addEventListener('click', function() { clearInterval(intervalId); elapsedTime = 0; timeDisplay.textContent = '00:00:00'; running = false; startBtn.textContent = 'Start ⏱️'; }); </script> </body> </html>