Untitled
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background-color: black; color: red; font-family: 'Arial', sans-serif; } #clock { font-size: 4em; } </style> <title>Red Clock</title> </head> <body> <div id="clock"></div> <script> function updateClock() { const now = new Date(); const hours = now.getHours().toString().padStart(2, '0'); const minutes = now.getMinutes().toString().padStart(2, '0'); const seconds = now.getSeconds().toString().padStart(2, '0'); const clockElement = document.getElementById('clock'); clockElement.textContent = `${hours}:${minutes}:${seconds}`; } // Update the clock every second setInterval(updateClock, 1000); // Initial call to display the clock immediately updateClock(); </script> </body> </html>
Leave a Comment