質問編集履歴

2

HTML、SCSS追加

2021/10/27 01:48

投稿

Fujiman
Fujiman

スコア41

test CHANGED
File without changes
test CHANGED
@@ -38,7 +38,395 @@
38
38
 
39
39
  ```
40
40
 
41
-
41
+ ```HTML
42
+
43
+ <div class="container">
44
+
45
+ <div class="item"></div>
46
+
47
+ <div class="item"></div>
48
+
49
+ <div class="item"></div>
50
+
51
+ <div class="item"></div>
52
+
53
+ <div class="item"></div>
54
+
55
+ <div class="item"></div>
56
+
57
+ <div class="item"></div>
58
+
59
+ <div class="item"></div>
60
+
61
+ </div>
62
+
63
+
64
+
65
+ <div class="text-box">
66
+
67
+ <span class="text">Stan Lee</span>
68
+
69
+ <span class="text">1922-2018</span>
70
+
71
+ </div>
72
+
73
+ ```
74
+
75
+ ```SCSS
76
+
77
+ /*** Fonts ***/
78
+
79
+ @import url('https://fonts.googleapis.com/css?family=Bangers');
80
+
81
+
82
+
83
+ /*** Box Reset ***/
84
+
85
+ * {
86
+
87
+ box-sizing: border-box;
88
+
89
+ }
90
+
91
+
92
+
93
+ body {
94
+
95
+ background-color: #e3e3e3;
96
+
97
+ }
98
+
99
+
100
+
101
+ .container{
102
+
103
+ display: grid;
104
+
105
+ grid-template-columns: repeat(3, 1fr);
106
+
107
+ grid-auto-rows: 1fr;
108
+
109
+ grid-gap: 1em;
110
+
111
+ max-width: 1440px;
112
+
113
+ margin: 0 auto;
114
+
115
+ }
116
+
117
+
118
+
119
+ .item{
120
+
121
+ display: inline-block;
122
+
123
+ min-height: 400px;
124
+
125
+ width: 50%;
126
+
127
+ background-position: center center;
128
+
129
+ background-repeat: no-repeat;
130
+
131
+ background-size: cover;
132
+
133
+ }
134
+
135
+
136
+
137
+ /*** Images With Color Fallbacks ***/
138
+
139
+ .item:nth-child(1){
140
+
141
+ background-color: #e74c3c;
142
+
143
+ background-image: url(https://i.pinimg.com/originals/e1/12/f8/e112f875d7f05db887f3d7750474fb1a.jpg);
144
+
145
+ background-position: center top;
146
+
147
+ }
148
+
149
+
150
+
151
+ .item:nth-child(2){
152
+
153
+ background-color: #3498db;
154
+
155
+ background-image: url(https://static.comicvine.com/uploads/original/8/80103/4528554-amazing_spider-man_vol_3_19.1_ponsor_variant_textless.jpg);
156
+
157
+ background-position: center 35%;
158
+
159
+ }
160
+
161
+
162
+
163
+ .item:nth-child(3){
164
+
165
+ background-color: #bdc3c7;
166
+
167
+ background-image: url(http://www.writeups.org/wp-content/uploads/Black-Panther-Avengers-Marvel-Comics-h427.jpg);
168
+
169
+ background-position: center 20%;
170
+
171
+ }
172
+
173
+
174
+
175
+ .item:nth-child(4){
176
+
177
+ background-color: #2c3e50;
178
+
179
+ background-image: url(http://designrfix.com/wp-content/uploads/2010/05/The-incredible-hulk-art-12.jpg);
180
+
181
+ }
182
+
183
+
184
+
185
+ .item:nth-child(5){
186
+
187
+ background-color: #2c3e50;
188
+
189
+ background-image: url(http://image.noelshack.com/fichiers/2018/46/1/1542053976-stanleefol5.png);
190
+
191
+ background-position: center 20px;
192
+
193
+ }
194
+
195
+
196
+
197
+ .item:nth-child(6){
198
+
199
+ background-color: #27ae60;
200
+
201
+ background-image: url(http://cdn.collider.com/wp-content/uploads/2015/01/fantastic-four-comic-2.jpg);
202
+
203
+ background-position: 50% 25%;
204
+
205
+ }
206
+
207
+
208
+
209
+ .item:nth-child(7){
210
+
211
+ background-color: #f1c40f;
212
+
213
+ background-image: url(https://nerdeux.files.wordpress.com/2011/09/rogues-thor-01.jpg);
214
+
215
+ background-position: left 27%;
216
+
217
+ }
218
+
219
+
220
+
221
+ .item:nth-child(8){
222
+
223
+ background-color: #2980b9;
224
+
225
+ background-image: url(https://2.bp.blogspot.com/-YSoMZR-S8CU/VRhKBl7HsZI/AAAAAAAAQqs/_s8iKmBMCUs/s1600/x-men-1-cover.jpg);
226
+
227
+ background-position: center 22%;
228
+
229
+ }
230
+
231
+
232
+
233
+ /*** Grid Set Up ***/
234
+
235
+ @supports (display:grid){
236
+
237
+ .item{
238
+
239
+ width: auto;
240
+
241
+ min-height: 0;
242
+
243
+ }
244
+
245
+
246
+
247
+ .item:nth-child(1){
248
+
249
+ grid-column: 1 / span 1;
250
+
251
+ grid-row: 1 / 20;
252
+
253
+ -webkit-clip-path: polygon(0 0, 80% 0, 100% 76.5%, 0 100%);
254
+
255
+ clip-path: polygon(0 0, 80% 0, 100% 76.5%, 0 100%);
256
+
257
+ margin-bottom: -93px;
258
+
259
+ }
260
+
261
+
262
+
263
+ .item:nth-child(2){
264
+
265
+ grid-column: 2 / span 1;
266
+
267
+ grid-row: 1 / 20;
268
+
269
+ -webkit-clip-path: polygon(0 0, 100% 0, 75% 80%, 15.5% 100%);
270
+
271
+ clip-path: polygon(0 0, 100% 0, 75% 80%, 15.5% 100%);
272
+
273
+ margin-left: -21%;
274
+
275
+ margin-right: -5%;
276
+
277
+ }
278
+
279
+
280
+
281
+ .item:nth-child(3){
282
+
283
+ grid-column: 3 / span 1;
284
+
285
+ grid-row: 1 / 20;
286
+
287
+ -webkit-clip-path: polygon(25% 0, 100% 0, 100% 100%, 0 53%);
288
+
289
+ clip-path: polygon(25% 0, 100% 0, 100% 100%, 0 53%);
290
+
291
+ margin-left: -28%;
292
+
293
+ margin-bottom: -150px;
294
+
295
+ }
296
+
297
+
298
+
299
+ .item:nth-child(4){
300
+
301
+ grid-column: 1 / span 1;
302
+
303
+ grid-row: 20 / 40;
304
+
305
+ -webkit-clip-path: polygon(0 22.5%, 100% 0, 100% 77.5%, 0 100%);
306
+
307
+ clip-path: polygon(0 22.5%, 100% 0, 100% 77.5%, 0 100%);
308
+
309
+ margin-top: -5px;
310
+
311
+ margin-bottom: -93px;
312
+
313
+ }
314
+
315
+
316
+
317
+ .item:nth-child(5){
318
+
319
+ grid-column: 2 / span 1;
320
+
321
+ grid-row: 20 / 40;
322
+
323
+ -webkit-clip-path: polygon(0 13%, 74% 0, 100% 9.25%, 100% 100%, 0 100%);
324
+
325
+ clip-path: polygon(0 13%, 74% 0, 100% 9.25%, 100% 82%, 65% 100%,0 82%);
326
+
327
+ margin-top: -67px;
328
+
329
+ margin-left: -1%;
330
+
331
+ margin-bottom: -86px;
332
+
333
+ }
334
+
335
+
336
+
337
+ .item:nth-child(6){
338
+
339
+ grid-column: 3 / span 1;
340
+
341
+ grid-row: 20 / 40;
342
+
343
+ -webkit-clip-path: polygon(0 0, 100% 34.5%, 100% 100%, 0 68.5%) ;
344
+
345
+ clip-path: polygon(0 0, 100% 34.5%, 100% 100%, 0 68.5%);
346
+
347
+ margin-left: -1%;
348
+
349
+ margin-top: -20px;
350
+
351
+ margin-bottom: -150px;
352
+
353
+ }
354
+
355
+
356
+
357
+ .item:nth-child(7){
358
+
359
+ grid-column: 1 / 3;
360
+
361
+ grid-row: 40 / 60;
362
+
363
+ -webkit-clip-path: polygon(0 30%, 49% 0, 75% 38%, 34% 100%, 0 100%);
364
+
365
+ clip-path: polygon(0 30%, 49% 0, 82% 27%, 34% 100%, 0 100%);
366
+
367
+ margin-top: -7px;
368
+
369
+ }
370
+
371
+
372
+
373
+ .item:nth-child(8){
374
+
375
+ grid-column: 2 / span 2;
376
+
377
+ grid-row: 40 / 60;
378
+
379
+ -webkit-clip-path: polygon(0 100%, 57% 0, 100% 48%, 100% 100%, 0 100%);
380
+
381
+ clip-path: polygon(0 100%, 57% 0, 100% 48%, 100% 100%, 0 100%);
382
+
383
+ margin-left: -15%;
384
+
385
+ margin-top: -7px;
386
+
387
+ }
388
+
389
+ }
390
+
391
+
392
+
393
+ /*** Floating Text ***/
394
+
395
+ .text-box{
396
+
397
+ position: absolute;
398
+
399
+ top: 560px;
400
+
401
+ margin-left: auto;
402
+
403
+ margin-right: auto;
404
+
405
+ left: 0;
406
+
407
+ right: 0;
408
+
409
+ }
410
+
411
+
412
+
413
+ .text{
414
+
415
+ display: block;
416
+
417
+ text-align: center;
418
+
419
+ color: whitesmoke;
420
+
421
+ text-shadow: 0px 3px 15px #000;
422
+
423
+ font-family: 'Bangers', cursive;
424
+
425
+ font-size: 3.5vmax;
426
+
427
+ }
428
+
429
+ ```
42
430
 
43
431
  grid-auto-rowsはgrid-template-rowsの指定がない場合、
44
432
 

1

訂正

2021/10/27 01:48

投稿

Fujiman
Fujiman

スコア41

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  当初、思ったのは、列が3列指定になっているので、これだと
14
14
 
15
- 3セルごとにrowができ、このサンプルだと要素あるので
15
+ 3セルごとにrowができ、このサンプルだと要素あるので
16
16
 
17
17
  3段だけのグリッドになるのでは?
18
18