Skip to content

Commit a6db4f0

Browse files
committed
added digital clock
1 parent 2458fed commit a6db4f0

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<link rel="stylesheet" type="text/css" href="../styles.css" />
8+
<title>Your Local Time</title>
9+
<style>
10+
body {
11+
background-color: #212121;
12+
color: #fff;
13+
}
14+
.center {
15+
display: flex;
16+
height: 100vh;
17+
justify-content: center;
18+
align-items: center;
19+
flex-direction: column;
20+
}
21+
#clock {
22+
font-size: 40px;
23+
background-color: orange;
24+
padding: 20px 50px;
25+
margin-top: 10px;
26+
border-radius: 10px;
27+
}
28+
</style>
29+
</head>
30+
<body>
31+
<nav>
32+
<a href="/" aria-current="page">Home</a>
33+
<a target="_blank" href="https://www.youtube.com/@chaiaurcode"
34+
>Youtube channel</a
35+
>
36+
</nav>
37+
<div class="center">
38+
<div id="banner"><span>Your local time</span></div>
39+
<div id="clock"></div>
40+
</div>
41+
<script src="script.js"></script>
42+
</body>
43+
</html>

projects/03_DigitalClock/script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const clock =document.getElementById('clock');
2+
3+
setInterval(function(){
4+
5+
let date=new Date();
6+
clock.innerHTML=date.toLocaleTimeString();
7+
},1000)

0 commit comments

Comments
 (0)