Skip to content

Commit 343e99f

Browse files
committed
Added: up to 4.63 Aligning Grid Items and Tracks
1 parent 80cd7af commit 343e99f

File tree

1 file changed

+46
-9
lines changed

1 file changed

+46
-9
lines changed

ongoing/04-CSS-Layouts/css-grid.html

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
.el--3 {
1616
background-color: green;
17-
/* height: 150px; */
17+
height: 150px;
1818
}
1919
.el--4 {
2020
background-color: goldenrod;
@@ -33,37 +33,74 @@
3333
}
3434

3535
.container--1 {
36+
display: none;
3637
/* STARTER */
3738
font-family: sans-serif;
3839
background-color: #ddd;
3940
font-size: 30px;
4041
margin: 40px;
4142

4243
/* CSS GRID */
43-
display: grid;
44+
/* display: grid; */
4445
/* grid-template-columns: 1fr 1fr 1fr auto; */
4546
/* grid-template-rows: 300px 200px; */
4647
grid-template-columns: repeat(4, 1fr);
47-
grid-template-rows: 1fr auto;
48-
height: 500px;
48+
grid-template-rows: 1fr 1fr;
49+
/* height: 500px; */
4950

5051
/* gap: 30px; */
51-
column-gap: 10px;
52+
column-gap: 20px;
5253
row-gap: 40px;
5354
}
5455

56+
.el--8 {
57+
grid-column: 2 / 3;
58+
/* grid-row: 1 / span 3; */
59+
grid-row: 1 / 2;
60+
}
61+
62+
.el--2 {
63+
/* grid-column: 1 / span 1;
64+
grid-row: 2; */
65+
/* grid-column: 1 / -1; */
66+
/* grid-row: 2; */
67+
}
68+
69+
.el--6 {
70+
/* grid-row: 3 / 5; */
71+
}
72+
5573
.container--2 {
56-
display: none;
74+
/* display: none; */
5775
/* STARTER */
5876
font-family: sans-serif;
5977
background-color: black;
6078
font-size: 40px;
61-
margin: 100px;
79+
margin: 40px;
6280

63-
width: 1000px;
81+
width: 700px;
6482
height: 600px;
6583

6684
/* CSS GRID */
85+
display: grid;
86+
grid-template-columns: 125px 200px 125px;
87+
grid-template-rows: 250px 100px;
88+
89+
gap: 50px;
90+
91+
/* Aligning tracks inside container: distribute empty space */
92+
justify-content: center;
93+
/* justify-content: space-between; */
94+
align-content: center;
95+
96+
/* Aligning items INSIDE cells: moving items around inside cells*/
97+
align-items: end;
98+
justify-items: end;
99+
}
100+
101+
.el--3 {
102+
align-self: center;
103+
justify-self: center;
67104
}
68105
</style>
69106
</head>
@@ -75,7 +112,7 @@
75112
<div class="el el--4">(4) are</div>
76113
<div class="el el--5">(5) amazing</div>
77114
<div class="el el--6">(6) languages</div>
78-
<div class="el el--7">(7) to</div>
115+
<!-- <div class="el el--7">(7) to</div> -->
79116
<div class="el el--8">(8) learn</div>
80117
</div>
81118

0 commit comments

Comments
 (0)