Skip to content

Commit 2c7712f

Browse files
committed
done
1 parent 46b9067 commit 2c7712f

4 files changed

Lines changed: 80 additions & 0 deletions

File tree

Digitalclock/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
<title>Digital Clock</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
11+
<div class="container">
12+
<div class="card">
13+
<h1>Digital Clock</h1>
14+
15+
</div>
16+
<div class="clock">
17+
<span class="time-element">00</span>
18+
<span></span>
19+
<span class="time-element">00</span>
20+
<span></span>
21+
<span class="time-element">00</span>
22+
</div>
23+
</div>
24+
<script src="script.js"></script>
25+
</body>
26+
</html>

Digitalclock/script.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
function updateClock(){
2+
3+
let now = new Date();
4+
let hours= now.getHours();
5+
let minutes = now.getMinutes();
6+
let seconds=now.getSeconds();
7+
const hoursElement= document.getElementById("hours");
8+
const minutesElement =document.getElementById("minutes");
9+
const secondElement = document.getElementById("second")
10+
11+
12+
hours= hours<10 ?"0"+ hours:hours;
13+
minutes= minutes<10 ?"0"+ minutes:minutes;
14+
seconds= seconds<10 ?"0"+ seconds:seconds;
15+
16+
17+
hoursElement.textContent= hours;
18+
minutesElement.textContent=minutes;
19+
secondElement.textContent=seconds;
20+
}
21+
22+
setInterval(updateClock,1000);

Digitalclock/style.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
body{
2+
margin: 0%;
3+
padding: 0%;
4+
border-style: border-box;
5+
6+
7+
}
8+
9+
.container{
10+
display: flex;
11+
flex-direction: column;
12+
justify-content: center;
13+
align-items: center;
14+
height: 100vh;
15+
background-color: lightblue;
16+
17+
}
18+
19+
.card{
20+
background-color: white;
21+
border-radius: 13px;
22+
box-shadow: 0px 0px 10px rgba(0, 0,0, 5);
23+
border: 2px black;
24+
max-width: 400px;
25+
26+
}
27+
28+
.h1{
29+
text-align: center;
30+
background-color: aliceblue;
31+
32+
}
File renamed without changes.

0 commit comments

Comments
 (0)