-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdigital-watch.html
72 lines (63 loc) · 1.45 KB
/
digital-watch.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Digital Watch</title>
<style>
body {
background: #333;
text-align: center;
}
#greeting {
color: white;
font-family: Arial;
font-size: 1.6em;
margin-top: 50px;
margin-bottom: 10px;
}
#message {
margin-top: 10px;
font-family: Arial;
font-size: 3.5em;
color: white;
}
.clock {
font-size: 4em;
text-align: center;
margin: 80px auto;
color: red;
font-family: Arial;
}
.clock span {
padding: 20px;
background: #260C0C;
width: 250px;
height: 150px;
}
</style>
</head>
<body>
<p id="greeting">Hello Aspiring World Class Developers</p>
<p id="message">Here you go! Enjoy Your Digital Watch</p>
<div class="clock"></div>
<script>
const date = new Date();
const digital_clock = document.querySelector('.clock')
const tick = () => {
const now = new Date();
const hour = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
const createClockHtml = `
<span>${hour}</span> :
<span>${minutes}</span> :
<span>${seconds}</span>
`
digital_clock.innerHTML = createClockHtml;
}
setInterval(tick, 1000);
</script>
</body>
</html>