File tree 4 files changed +37
-4
lines changed
4 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 4
4
"strings" : " on" ,
5
5
"other" : " on"
6
6
},
7
- "liveServer.settings.port" : 5502
7
+ "liveServer.settings.port" : 5503
8
8
}
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ nav a {
17
17
border-radius : 0.3rem ;
18
18
border : solid black;
19
19
background-color : aliceblue;
20
+ text-align : center;
20
21
text-decoration-line : none;
21
22
padding : 5px ;
22
23
}
@@ -25,4 +26,20 @@ nav a {
25
26
box-sizing : border-box;
26
27
}
27
28
28
- /* navbar */
29
+ /* navbar */
30
+
31
+ body {
32
+ padding : 25px ;
33
+ background-color : white;
34
+ color : black;
35
+ font-size : 25px ;
36
+ }
37
+
38
+ .dark-mode {
39
+ background-color : black;
40
+ color : white;
41
+ }
42
+
43
+ button {
44
+ align-items : center;
45
+ }
Original file line number Diff line number Diff line change 4
4
< head >
5
5
< meta charset ="UTF-8 ">
6
6
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7
+
7
8
< title > Light & Dark Mode</ title >
8
9
< link rel ="stylesheet " href ="index.css ">
9
10
</ head >
17
18
18
19
< body >
19
20
< form >
20
- < label > click to change mode </ label >
21
- < input type ="checkbox ">
21
+
22
+ < button class ="modeBtn " onclick ="changeMode(event) "> < label > click to change mode </ label > </ button >
23
+
24
+
22
25
</ form >
26
+ < h1 > Here is h1 element</ h1 >
27
+ < h2 > Here is h2 element</ h2 >
28
+ < h3 > Here is h3 element</ h3 >
29
+ < h1 > Here is h1 element</ h1 >
30
+ < h5 > Here is h5 element</ h5 >
31
+ < script src ="index.js " defer > </ script >
32
+
23
33
</ body >
24
34
25
35
</ html >
Original file line number Diff line number Diff line change
1
+
2
+ function changeMode ( event ) {
3
+ event . preventDefault ( )
4
+ var element = document . body ;
5
+ element . classList . toggle ( "dark-mode" ) ;
6
+ }
You can’t perform that action at this time.
0 commit comments