Professional 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>Professional Stopwatch</title> <style> body { font-family: 'Arial', sans-serif; background: linear-gradient(135deg, #f5f7fa, #c3cfe2); display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .stopwatch { background: #fff; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); padding: 30px; text-align: center; max-width: 400px; width: 100%; } .stopwatch .time { font-size: 3rem; margin-bottom: 20px; color: #333; font-weight: bold; } .stopwatch .buttons { display: flex; justify-content: space-between; } .stopwatch button { background: #007bff; border: none; border-radius: 50px; color: #fff; font-size: 1rem; padding: 10px 20px; cursor: pointer; transition: background 0.3s; box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3); } .stopwatch button:hover { background: #0056b3; } .stopwatch button:active { background: #004080; box-shadow: 0 2px 10px rgba(0, 123, 255, 0.2); } .stopwatch button:focus { outline: none; } .stopwatch .start-btn { animation: pulse 2s infinite; } .stopwatch .reset-btn { background: #dc3545; } .stopwatch .reset-btn:hover { background: #b52a37; } .stopwatch .reset-btn:active { background: #891f2a; } .stopwatch .reset-btn:focus { outline: none; } @keyframes pulse { 0% { box-shadow: 0 0 5px rgba(0, 123, 255, 0.7); } 50% { box-shadow: 0 0 20px rgba(0, 123, 255, 0.7); } 100% { box-shadow: 0 0 5px rgba(0, 123, 255, 0.7); } } .stopwatch .icons { display: flex; justify-content: space-around; margin-top: 20px; } .stopwatch .icon { font-size: 2rem; } .stopwatch .icon.emoji { font-size: 3rem; } </style> </head> <body> <div class="stopwatch"> <div class="time">00:00:00</div> <div class="buttons"> <button class="start-btn">Start ⏱️</button> <button class="reset-btn">Reset 🔄</button> </div> <div class="icons"> <div class="icon emoji">⏳</div> <div class="icon emoji">⌚</div> <div class="icon emoji">⏲️</div> </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>