-
Notifications
You must be signed in to change notification settings - Fork 0
/
11-grid.html
98 lines (83 loc) · 2.55 KB
/
11-grid.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Grid</title>
<style>
.container {
border: 1px solid black;
margin-top: 10px;
padding: 10px;
/* height: 500px; */
/* create grid container */
display: grid;
/* set columns width */
/* grid-template-columns: 100px 300px 50px; */
/* grid-template-columns: 20% 30% 50%; */
/* grid-template-columns: 200px 3fr 2fr; */
grid-template-columns: 100px repeat(2, 1fr 2fr);
/* set rows height */
grid-template-rows: 100px 50px 100px;
/* column-gap: 10px; */
/* row-gap: 10px; */
gap: 5px;
/* horizontal align all items in cell */
justify-items: center;
/* vertical align all items in cell */
align-items: center;
/* align columns */
justify-content: space-between;
/* align rows */
align-content: end;
}
.container div {
padding: 0.3em;
border-radius: 3px;
text-align: center;
background-color: #482880;
color: #ffffff;
font-size: 130%;
font-weight: bold;
}
.container div:nth-child(odd) {
background-color: #1769aa;
}
.item-1 {
/* grid-column-start: 1; */
/* grid-column-end: 4; */
/* grid-column: 1 / 4; */
grid-column: span 3;
/* grid-row-start: 1; */
/* grid-row-end: 3; */
grid-row: span 2;
}
.item-2 {
grid-column: span 2;
}
.item-5 {
justify-self: center;
align-self: center;
}
</style>
</head>
<body>
<div class="container">
<div class="item-1">1</div>
<div class="item-2">2</div>
<div class="item-3">3</div>
<div class="item-4">4</div>
<div class="item-5">5</div>
<div class="item-6">6</div>
<div class="item-7">7</div>
<div class="item-8">8</div>
<div class="item-9">9</div>
<div class="item-10">10</div>
<div class="item-11">11</div>
<div class="item-12">12</div>
<div class="item-13">13</div>
<div class="item-14">14</div>
</div>
</body>
</html>