clock
custom.js
'use strict'const time = document.getElementById('time')function updateTime() {const currentTime = new Date()const hh = currentTime.getHours()const mm = currentTime.getMinutes()const ss = currentTime.getSeconds()// Format time to iprefix 0 if < 10const formattedTime = `${zeroPadder(hh)} : ${zeroPadder(mm)} : ${zeroPadder(ss)}`time.innerHTML = formattedTime}function zeroPadder(n) {return (parseInt(n, 10) < 10 ? '0' : '') + n}updateTime()setInterval(updateTime, 1000)
index.html
<!DOCTYPE html><html><head><meta charset="utf-8"><title>JavaScript Clock</title><meta name="robots" content="noindex, nofollow"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="styles.css"></head><body><header><h1>JavaScript Clock</h1></header><div class="wrapper"><div class="container"><time id="time"></time></div><!-- .container--></div><!-- .wrapper--><footer><small><a href="https://opensource.org/licenses/MIT">MIT</a></small></footer><script src="custom.js"></script></body></html>
styles.css
body {background: #eeeeee;font-size: 16px;font-family: "Trebuchet MS", Helvetica, sans-serif;margin: 0;}a {color: crimson;text-decoration: none;}a:hover {color: red;}/* Layout------------------------------------------*/header,.container,footer {margin: 0 auto;width: 88%;max-width: 1080px;}.wrapper {padding: 1em 0;background: #ffffff;}/* Table------------------------------------------*/td:first-child {text-align: right;}td {padding: .5em 0 .5em .7em;}.calculator {max-width: 266px;display: flex;flex-direction: column;align-items: flex-end;}input {font-size: 1em;background: linear-gradient(#eeeeee, #ffffff);border-top: 2px solid #cccccc;border-left: 2px solid #cccccc;border-bottom: 2px solid #eeeeee;border-bottom: 2px solid #eeeeee;padding: .5em;}button {font-size: 1em;border: none;background: linear-gradient(#ffffff, #eeeeee);outline: 0;padding: .5em 1em;border-radius: 15px;text-shadow: 1px 1px 3px rgba(198, 198, 198, 0.9);border: 2px solid #eeeeee;}button:hover {background: linear-gradient(#eeeeee, #ffffff);}