File tree 3 files changed +65
-0
lines changed
3 files changed +65
-0
lines changed Original file line number Diff line number Diff line change
1
+ body {
2
+ background-color : # FFFACD
3
+ ;
4
+ }
5
+
6
+ body button {
7
+ display : block;
8
+ margin : 10px auto;
9
+ width : 240px ;
10
+ height : 40px ;
11
+
12
+ }
13
+
14
+ button {
15
+ background-color : # EEE8AA ;
16
+ border : 2px solid # 696969 ;
17
+ font-family : 'Courier New' , Courier, monospace ;
18
+ width : 30px ;
19
+ height : 30px ;
20
+ }
21
+
22
+ div {
23
+ display : inline-block;
24
+ border : 2px solid # 696969 ;
25
+ padding : 20px ;
26
+ margin : 10px ;
27
+ background-color : # EEE8AA ;
28
+
29
+ }
30
+
31
+ .circle {
32
+ border-radius : 50% ;
33
+ background-color : # DEB887 ;
34
+
35
+ }
Original file line number Diff line number Diff line change
1
+ < html lang ="en ">
2
+ < head >
3
+ < meta charset ="UTF-8 ">
4
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
5
+ < title > Dodawanie elementow</ title >
6
+ </ head >
7
+ < link rel ="stylesheet " href ="arkusz.css ">
8
+ < body >
9
+ < button > Kliknij, by utworzyc element</ button >
10
+
11
+ < script src ="newMain.js "> </ script >
12
+ </ body >
13
+ </ html >
Original file line number Diff line number Diff line change
1
+ const btn = document . querySelector ( 'button' )
2
+ let number = 1
3
+
4
+ const addElement = function ( ) {
5
+ let div = document . createElement ( 'div' ) ;
6
+ div . textContent = number ;
7
+ document . body . appendChild ( div ) ;
8
+
9
+
10
+ if ( number % 5 == 0 ) {
11
+ div . classList . add ( 'circle' )
12
+
13
+ }
14
+ number ++ ;
15
+ }
16
+
17
+ btn . addEventListener ( 'click' , addElement )
You can’t perform that action at this time.
0 commit comments