File tree Expand file tree Collapse file tree 4 files changed +51
-0
lines changed
Expand file tree Collapse file tree 4 files changed +51
-0
lines changed 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 > Countdown Timer</ title >
7+ < link rel ="stylesheet " href ="style.css ">
8+ < script defer src ="script.js "> </ script >
9+ </ head >
10+ < body >
11+ < div class ="container ">
12+ < p id ="countDown "> 30:00</ p >
13+ </ div >
14+ </ body >
15+ </ html >
Original file line number Diff line number Diff line change 1+ const startMinutes = 30 ;
2+ const startHour = 1 ;
3+
4+ let time = startMinutes * 60 ;
5+ let countDown = document . getElementById ( "countDown" ) ;
6+
7+ setInterval ( countdown , 1000 ) ;
8+
9+ function countdown ( ) {
10+ let hour = ( new Date ( ) ) . getHours ( ) ;
11+ let minutes = Math . floor ( time / 60 ) ;
12+ let seconds = time % 60 ;
13+ seconds = seconds < 10 ? "0" + seconds : seconds ;
14+ countDown . innerHTML = hour + ":" + minutes + ":" + seconds ;
15+ time -- ;
16+ }
Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0 ;
3+ padding : 0 ;
4+ box-sizing : border-box;
5+ }
6+
7+ .container {
8+ display : flex;
9+ flex-direction : column;
10+ justify-content : center;
11+ align-items : center;
12+ height : 100vh ;
13+ width : 100% ;
14+ background-color : # 222 ;
15+ color : # fff ;
16+ font-family : cursive;
17+ font-size : 10em ;
18+ text-align : center;
19+ font-weight : 700 ;
20+ }
You can’t perform that action at this time.
0 commit comments