File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 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 ) ;
Original file line number Diff line number Diff line change 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.
You can’t perform that action at this time.
0 commit comments