-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcss-grid.html
executable file
·115 lines (102 loc) · 2.63 KB
/
css-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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!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>
.el--1 {
background-color: blueviolet;
}
.el--2 {
background-color: orangered;
}
.el--3 {
background-color: green;
height: 150px;
}
.el--4 {
background-color: goldenrod;
}
.el--5 {
background-color: palevioletred;
}
.el--6 {
background-color: steelblue;
}
.el--7 {
background-color: yellow;
}
.el--8 {
background-color: crimson;
}
.container--1 {
/* STARTER */
font-family: sans-serif;
background-color: #ddd;
font-size: 30px;
margin: 40px;
/* CSS GRID */
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: 1fr 1fr;
column-gap: 20px;
row-gap: 40px;
display: grid;
}
.el--8 {
grid-column: 2 / 3;
grid-row: 1 / 2;
}
.el--2 {
grid-column: 1 / -1;
grid-row: 2;
}
.container--2 {
/* STARTER */
font-family: sans-serif;
background-color: black;
font-size: 40px;
margin: 40px;
width: 700px;
height: 600px;
/* CSS GRID */
display: grid;
grid-template-columns: 125px 200px 125px;
grid-template-rows: 250px 100px;
gap: 50px;
/* Aligning tracks inside container: distribute empty space */
justify-content: center;
align-content: center;
/* Aligning items INSIDE cells: moving items around inside cells */
align-items: end;
justify-items: end;
}
.el--3 {
align-self: center;
justify-self: center;
}
</style>
</head>
<body>
<div class="container--1">
<div class="el el--1">(1) HTML</div>
<div class="el el--2">(2) and</div>
<div class="el el--3">(3) CSS</div>
<div class="el el--4">(4) are</div>
<div class="el el--5">(5) amazing</div>
<div class="el el--6">(6) languages</div>
<div class="el el--7">(7) to</div>
<div class="el el--8">(8) learn</div>
</div>
<div class="container--2">
<div class="el el--1">(1)</div>
<div class="el el--3">(3)</div>
<div class="el el--4">(4)</div>
<div class="el el--5">(5)</div>
<div class="el el--6">(6)</div>
<div class="el el--7">(7)</div>
</div>
</body>
</html>