Skip to content

Commit cea9e36

Browse files
committed
Update css-grid.html
1 parent 91a8085 commit cea9e36

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

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

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,80 @@
1111
}
1212
.el--2 {
1313
background-color: orangered;
14+
grid-column: 1 / -1;
15+
grid-row: 2 / 3;
1416
}
1517
.el--3 {
1618
background-color: green;
17-
height: 150px;
19+
height: 100px;
20+
align-self: start;
21+
justify-self: center;
1822
}
1923
.el--4 {
2024
background-color: goldenrod;
2125
}
2226
.el--5 {
2327
background-color: palevioletred;
28+
grid-row: 3 / 6;
2429
}
2530
.el--6 {
2631
background-color: steelblue;
32+
grid-row: 3 / 6;
2733
}
2834
.el--7 {
2935
background-color: yellow;
3036
}
3137
.el--8 {
3238
background-color: crimson;
39+
grid-column: 2 / 3; /*start at column 2 end at 3.*/
40+
grid-row: 1 / 2; /*start at row 1 and end at 2.*/
41+
/*span rows and columns by increasing the start and end values.*/
3342
}
3443

3544
.container--1 {
3645
/* STARTER */
3746
font-family: sans-serif;
3847
background-color: #ddd;
3948
font-size: 40px;
40-
margin: 40px;
49+
/*margin: 40px;*/
50+
width: 1800px;
51+
height: 400px;
4152

4253
/* CSS GRID */
54+
display: grid;
55+
/*grid-template-columns: 1fr 1fr 1fr auto;*/
56+
grid-template-columns: repeat(4, 1fr);
57+
/*grid-template-rows: 300px 200px;*/
58+
grid-template-rows: 1fr 1fr;
59+
column-gap: 20px;
60+
row-gap: 40px;
61+
4362
}
4463

4564
.container--2 {
4665
/* STARTER */
66+
/*display: none;*/ /*hide an element and everything in it.*/
4767
font-family: sans-serif;
48-
background-color: black;
68+
background-color: rgb(227, 227, 227);
4969
font-size: 40px;
50-
margin: 100px;
70+
margin: 40px;
5171

52-
width: 1000px;
72+
width: 700px;
5373
height: 600px;
5474

5575
/* CSS GRID */
76+
display: grid;
77+
grid-template-columns: 125px 200px 125px;
78+
grid-template-rows: 250px 100px;
79+
gap: 20px;
80+
81+
/*Aligning tracks in a container only possible when the container is bigger than the grid.*/
82+
justify-content: center;
83+
align-content: center;
84+
85+
/*Aligning items INSIDE cells*/
86+
align-items: center;
87+
justify-items: center;
5688
}
5789
</style>
5890
</head>
@@ -70,6 +102,7 @@
70102

71103
<div class="container--2">
72104
<div class="el el--1">(1)</div>
105+
<div class="el el--2">(2)</div>
73106
<div class="el el--3">(3)</div>
74107
<div class="el el--4">(4)</div>
75108
<div class="el el--5">(5)</div>

0 commit comments

Comments
 (0)