File tree Expand file tree Collapse file tree 4 files changed +259
-115
lines changed Expand file tree Collapse file tree 4 files changed +259
-115
lines changed Original file line number Diff line number Diff line change 1+ let countEl = document . getElementById ( "count" ) ;
2+ let saveEl = document . getElementById ( "save" ) ;
3+ let incrementBtn = document . querySelector ( ".increment-btn" ) ;
4+ let decrementBtn = document . querySelector ( ".decrement-btn" ) ;
5+ let saveBtn = document . querySelector ( ".save-btn" ) ;
6+
7+ let count = 0 ;
8+
9+ incrementBtn . addEventListener ( "click" , ( ) => {
10+ count += 1 ;
11+ countEl . textContent = count ;
12+ } ) ;
13+ decrementBtn . addEventListener ( "click" , ( ) => {
14+ count -= 1 ;
15+ countEl . textContent = count ;
16+ } ) ;
17+
18+ saveBtn . addEventListener ( "click" , ( ) => {
19+ let countStr = count + ", " ;
20+ saveEl . textContent += countStr ;
21+ countEl . textContent = 0 ;
22+ count = 0 ;
23+ } ) ;
Original file line number Diff line number Diff line change 1+ < html lang ="en ">
2+ < head >
3+ < meta charset ="UTF-8 " />
4+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6+ < title > Counter</ title >
7+ < link rel ="stylesheet " href ="style.css " />
8+ </ head >
9+ < body >
10+ < main class ="content ">
11+ < div class ="counter ">
12+ < div class ="counter-box " id ="count "> 0</ div >
13+ < div class ="btn-group ">
14+ < button class ="decrement-btn button "> DECREMENT (-)</ button >
15+ < button class ="increment-btn button "> INCREMENT (+)</ button >
16+ </ div >
17+ < button class ="save-btn button "> SAVE</ button >
18+ </ div >
19+
20+ < div class ="entries ">
21+ < p > SAVE / ENTRIES</ p >
22+ < div class ="entries-field " id ="save "> </ div >
23+ </ div >
24+ </ main >
25+
26+ < script src ="app.js "> </ script >
27+ </ body >
28+ </ html >
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+ button {
8+ border : none;
9+ outline : none;
10+ }
11+
12+ body {
13+ font-family : sans-serif;
14+ background-color : black;
15+ }
16+
17+ .content {
18+ max-width : 1440px ;
19+ margin : 0 auto;
20+ padding : 0 10rem ;
21+ }
22+
23+ .counter {
24+ display : flex;
25+ flex-direction : column;
26+ align-items : center;
27+ min-width : 50% ;
28+ max-width : min-content;
29+ margin : 1rem auto;
30+ }
31+
32+ .counter-box {
33+ width : 100% ;
34+ height : 160px ;
35+ display : flex;
36+ justify-content : center;
37+ align-items : center;
38+ color : # fff ;
39+ font-size : 100px ;
40+ font-weight : 600 ;
41+ background-color : rgba (43 , 42 , 42 , 0.959 );
42+ border-radius : 8px ;
43+ }
44+
45+ .button {
46+ width : 100% ;
47+ min-width : 85% ;
48+ height : 3em ;
49+ display : flex;
50+ justify-content : center;
51+ align-items : center;
52+ color : # fff ;
53+ font-size : 20px ;
54+ font-weight : 400 ;
55+ border-radius : 8px ;
56+ cursor : pointer;
57+ user-select : none;
58+ }
59+
60+ .btn-group {
61+ display : flex;
62+ justify-content : center;
63+ align-items : center;
64+ gap : 1rem ;
65+ }
66+
67+ .increment-btn {
68+ margin : 2em 0 1em 0 ;
69+ background-color : rgb (26 , 26 , 184 );
70+ font-weight : bold;
71+ }
72+ .decrement-btn {
73+ margin : 2em 0 1em 0 ;
74+ background-color : rgb (26 , 26 , 184 );
75+ font-weight : bold;
76+ }
77+
78+ .save-btn {
79+ background-color : # 00da7f ;
80+ font-weight : bold;
81+ }
82+
83+ .entries p {
84+ margin : 2.5rem 0 1em 0 ;
85+ font-size : 20px ;
86+ font-weight : 600 ;
87+ color : # fff ;
88+ }
89+
90+ .entries-field {
91+ font-size : 20px ;
92+ color : # fff ;
93+ }
You can’t perform that action at this time.
0 commit comments