Skip to content

Instantly share code, notes, and snippets.

@djramones
Created October 11, 2023 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djramones/6c05a0f69d9397245c09accae757c0dc to your computer and use it in GitHub Desktop.
Save djramones/6c05a0f69d9397245c09accae757c0dc to your computer and use it in GitHub Desktop.
Simple clock page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Clock</title>
<style>
body, div {
margin: 0;
padding: 0;
width: 100dvw;
height: 100dvh;
background-color: #123;
}
div {
display: grid;
place-items: center;
}
#time {
font-family: 'Roboto Mono', 'Segoe UI', monospace;
font-size: 10dvw;
font-weight: 700;
color: #ddd;
}
</style>
</head>
<body>
<div>
<span id="time"></span>
</div>
<script>
setTime = () => {
document.getElementById("time").textContent =
new Date().toLocaleTimeString()
}
setTime()
setInterval(setTime, 1000)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment