Skip to content

Commit 110dbdb

Browse files
committed
feat: sizing grid columns and rows
1 parent b36a711 commit 110dbdb

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

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

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,33 @@
4242
/* CSS GRID */
4343
display: grid;
4444

45-
/* * 4 columns */
46-
grid-template-columns: 250px 250px 150px 150px;
45+
/* Make all items have width proportions as follows */
46+
/* grid-template-columns: 2fr 2fr 1fr auto; */
47+
48+
/* Create 4 columns, each have the same width "1fr" */
49+
grid-template-columns: repeat(4, 1fr);
50+
4751
/* * 2 rows */
48-
grid-template-rows: 300px 200px;
52+
/* grid-template-rows: 300px 200px; */
53+
54+
/* Create 2 rows,
55+
both rows have height "1fr",
56+
which is equal to 150px (inherited from element ".el--3" which is the tallest element)
57+
*/
58+
grid-template-rows: 1fr 1fr;
59+
60+
/* Create 2 rows,
61+
1) second row have heght "auto",
62+
whcih is only take the space it need for its content.
63+
2) first row will the leftover height "1fr",
64+
which will filled the entire container.
65+
*/
66+
grid-template-rows: 1fr auto;
4967

5068
gap: 20px;
5169
column-gap: 30px;
5270
row-gap: 60px;
71+
height: 500px;
5372
}
5473

5574
.container--2 {

0 commit comments

Comments
 (0)