|
11 | 11 | }
|
12 | 12 | .el--2 {
|
13 | 13 | background-color: orangered;
|
| 14 | + grid-column: 1 / -1; |
| 15 | + grid-row: 2 / 3; |
14 | 16 | }
|
15 | 17 | .el--3 {
|
16 | 18 | background-color: green;
|
17 |
| - height: 150px; |
| 19 | + height: 100px; |
| 20 | + align-self: start; |
| 21 | + justify-self: center; |
18 | 22 | }
|
19 | 23 | .el--4 {
|
20 | 24 | background-color: goldenrod;
|
21 | 25 | }
|
22 | 26 | .el--5 {
|
23 | 27 | background-color: palevioletred;
|
| 28 | + grid-row: 3 / 6; |
24 | 29 | }
|
25 | 30 | .el--6 {
|
26 | 31 | background-color: steelblue;
|
| 32 | + grid-row: 3 / 6; |
27 | 33 | }
|
28 | 34 | .el--7 {
|
29 | 35 | background-color: yellow;
|
30 | 36 | }
|
31 | 37 | .el--8 {
|
32 | 38 | 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.*/ |
33 | 42 | }
|
34 | 43 |
|
35 | 44 | .container--1 {
|
36 | 45 | /* STARTER */
|
37 | 46 | font-family: sans-serif;
|
38 | 47 | background-color: #ddd;
|
39 | 48 | font-size: 40px;
|
40 |
| - margin: 40px; |
| 49 | + /*margin: 40px;*/ |
| 50 | + width: 1800px; |
| 51 | + height: 400px; |
41 | 52 |
|
42 | 53 | /* 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 | + |
43 | 62 | }
|
44 | 63 |
|
45 | 64 | .container--2 {
|
46 | 65 | /* STARTER */
|
| 66 | + /*display: none;*/ /*hide an element and everything in it.*/ |
47 | 67 | font-family: sans-serif;
|
48 |
| - background-color: black; |
| 68 | + background-color: rgb(227, 227, 227); |
49 | 69 | font-size: 40px;
|
50 |
| - margin: 100px; |
| 70 | + margin: 40px; |
51 | 71 |
|
52 |
| - width: 1000px; |
| 72 | + width: 700px; |
53 | 73 | height: 600px;
|
54 | 74 |
|
55 | 75 | /* 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; |
56 | 88 | }
|
57 | 89 | </style>
|
58 | 90 | </head>
|
|
70 | 102 |
|
71 | 103 | <div class="container--2">
|
72 | 104 | <div class="el el--1">(1)</div>
|
| 105 | + <div class="el el--2">(2)</div> |
73 | 106 | <div class="el el--3">(3)</div>
|
74 | 107 | <div class="el el--4">(4)</div>
|
75 | 108 | <div class="el el--5">(5)</div>
|
|
0 commit comments