Skip to content

Commit cf03933

Browse files
20 - CSS Grid Image Gallery Grid Style Added
1 parent 7348138 commit cf03933

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

20 - CSS Grid Image Gallery/image-gallery-START.html

+33-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,40 @@
5151
border: 0;
5252
}
5353

54-
.gallery {}
54+
.gallery {
55+
display: grid;
56+
grid-template-columns: repeat(auto-fill, 100px);
57+
grid-auto-rows: 100px;
58+
grid-auto-flow: dense;
59+
}
60+
61+
.item {
62+
overflow: hidden;
63+
}
64+
65+
.item.v2 {
66+
grid-row: span 2;
67+
}
68+
69+
.item.v3 {
70+
grid-row: span 3;
71+
}
72+
73+
.item.v4 {
74+
grid-row: span 4;
75+
}
5576

77+
.item.h2 {
78+
grid-column: span 2;
79+
}
5680

81+
.item.h3 {
82+
grid-column: span 3;
83+
}
84+
85+
.item.h4 {
86+
grid-column: span 4;
87+
}
5788

5889
.overlay {
5990
position: fixed;
@@ -102,7 +133,7 @@
102133
return Math.floor(Math.random() * limit + 1);
103134
}
104135

105-
const digits = Array.from({ length: 50}, () => [randomNumber(4), randomNumber(4)]);
136+
const digits = Array.from({ length: 50}, () => [randomNumber(4), randomNumber(4)]).concat([[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1]]);
106137

107138
const html = digits.map(generateHTML).join('');
108139
gallery.innerHTML = html;

0 commit comments

Comments
 (0)