/
demo9.html
83 lines (79 loc) · 1.62 KB
/
demo9.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
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.main {
width: 300px;
background: #fff4e6;
border: 2px solid #f76707;
border-radius: 5px;
margin: 50px;
display: grid;
}
.item {
color: #d9480f;
background: #ffd8a8;
border: 2px solid #ffa94d;
border-radius: 5px;
}
.m0 {
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 100px);
align-items: start;
}
.m0 > .item:nth-child(2) {
font-size: 28px;
}
.m0 > .item:nth-child(3) {
justify-self: start;
}
.m1 {
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 100px);
align-items: start;
}
.m1 > .item:nth-child(2) {
font-size: 28px;
}
.m1 > .item:nth-child(3) {
justify-self: end;
}
.m2 {
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 100px);
align-items: start;
}
.m2 > .item:nth-child(2) {
font-size: 28px;
}
.m2 > .item:nth-child(3) {
align-self: baseline;
justify-self: center;
}
</style>
</head>
<body>
<div class="main m0">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
</div>
<div class="main m1">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
</div>
<div class="main m2">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
</div>
</body>
</html>