-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay-2.html
79 lines (68 loc) · 1.74 KB
/
display-2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Display 2</title>
<style>
.container {
display: flex;
background: grey;
justify-content: space-between;
}
.container .item {
width: 100px;
height: 100px;
background: blueviolet;
margin: 10px;
}
.container .item:nth-child(2n + 1) {
background: blue;
}
.container-2 {
display: grid;
width: 400px;
height: 400px;
background: grey;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(4, 1fr);
}
.container-2 .item-2 {
background: blueviolet;
}
.container-2 .item-2:nth-child(1) {
grid-column: 1 / 2;
grid-row: 1 / 2;
}
.container-2 .item-2:nth-child(2) {
grid-column: 2 / 3;
grid-row: 2 / 3;
}
.container-2 .item-2:nth-child(3) {
grid-column: 3 / 4;
grid-row: 3 / 4;
}
.container-2 .item-2:nth-child(4) {
grid-column: 4 / 5;
grid-row: 4 / 5;
}
</style>
</head>
<body>
<!-- FlexBox -->
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
<br>
<!-- Grid -->
<div class="container-2">
<div class="item-2"></div>
<div class="item-2"></div>
<div class="item-2"></div>
<div class="item-2"></div>
</div>
</body>
</html>