回答編集履歴
3
修正
test
CHANGED
@@ -198,7 +198,7 @@
|
|
198
198
|
|
199
199
|
```
|
200
200
|
|
201
|
-
[CodePenサンプル](https://codepen.io/pen/?editors=0100)
|
201
|
+
[CodePenサンプル](https://codepen.io/hatena19/pen/GRqYoeB?editors=0100)
|
202
202
|
|
203
203
|
|
204
204
|
|
2
コード追記
test
CHANGED
@@ -199,3 +199,187 @@
|
|
199
199
|
```
|
200
200
|
|
201
201
|
[CodePenサンプル](https://codepen.io/pen/?editors=0100)
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
---
|
206
|
+
|
207
|
+
HTMLを変更してもいいのなら、CSS Grid を使うとシンプルに実現できます。
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
```html
|
212
|
+
|
213
|
+
<div class="wrapper">
|
214
|
+
|
215
|
+
<div class="header">
|
216
|
+
|
217
|
+
<p>#141f40</p>
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
<div class="side">
|
222
|
+
|
223
|
+
<p>#80bfa8</p>
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
<div class="content-left-top">
|
228
|
+
|
229
|
+
<p>#dbd400</p>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div class="content-left-bottom">
|
234
|
+
|
235
|
+
<p>#0093b7</p>
|
236
|
+
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="content-right">
|
240
|
+
|
241
|
+
<p>#ff9e6b</p>
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
<div class="content-bottom">
|
246
|
+
|
247
|
+
<p>#8c2727</p>
|
248
|
+
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<div class="footer">
|
252
|
+
|
253
|
+
<p>#d98d30</p>
|
254
|
+
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
```
|
260
|
+
|
261
|
+
```css
|
262
|
+
|
263
|
+
.wrapper {
|
264
|
+
|
265
|
+
width: 400px;
|
266
|
+
|
267
|
+
margin: auto;
|
268
|
+
|
269
|
+
display: grid;
|
270
|
+
|
271
|
+
grid-template-columns: 150px 150px 100px;
|
272
|
+
|
273
|
+
grid-template-rows: 100px 50px repeat(3, 100px);
|
274
|
+
|
275
|
+
}
|
276
|
+
|
277
|
+
.header {
|
278
|
+
|
279
|
+
grid-column: 1/4;
|
280
|
+
|
281
|
+
background-color: #141f40;
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
.side {
|
286
|
+
|
287
|
+
grid-row: span 3;
|
288
|
+
|
289
|
+
background-color: #80bfa8;
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
.content-left-top {
|
294
|
+
|
295
|
+
background-color: #dbd400;
|
296
|
+
|
297
|
+
}
|
298
|
+
|
299
|
+
.content-left-bottom {
|
300
|
+
|
301
|
+
grid-column: 2;
|
302
|
+
|
303
|
+
background-color: #0093b7;
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
.content-right {
|
308
|
+
|
309
|
+
grid-column: 3;
|
310
|
+
|
311
|
+
grid-row: 2/4;
|
312
|
+
|
313
|
+
background-color: #ff9e6b;
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
.content-bottom {
|
318
|
+
|
319
|
+
background-color: #8c2727;
|
320
|
+
|
321
|
+
grid-column: 2/4;
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
.footer {
|
326
|
+
|
327
|
+
grid-column: 1/4;
|
328
|
+
|
329
|
+
background-color: #d98d30;
|
330
|
+
|
331
|
+
}
|
332
|
+
|
333
|
+
p {
|
334
|
+
|
335
|
+
color:#fff;
|
336
|
+
|
337
|
+
padding:3px;
|
338
|
+
|
339
|
+
font-size:3px;
|
340
|
+
|
341
|
+
}
|
342
|
+
|
343
|
+
@media screen and (max-width: 767px) {
|
344
|
+
|
345
|
+
.wrapper {
|
346
|
+
|
347
|
+
width: 300px;
|
348
|
+
|
349
|
+
grid-template-columns: 100px 125px 75px;
|
350
|
+
|
351
|
+
}
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
@media screen and (max-width: 479px) {
|
356
|
+
|
357
|
+
.wrapper {
|
358
|
+
|
359
|
+
width: 150px;
|
360
|
+
|
361
|
+
grid-template-columns: 150px;
|
362
|
+
|
363
|
+
grid-template-rows: repeat(3, 100px) 50px repeat(3, 100px);
|
364
|
+
|
365
|
+
}
|
366
|
+
|
367
|
+
.wrapper > div {
|
368
|
+
|
369
|
+
grid-column: 1;
|
370
|
+
|
371
|
+
grid-row: span 1;
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
.wrapper > .content-right {
|
376
|
+
|
377
|
+
grid-row: 3;
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
```
|
384
|
+
|
385
|
+
[CodePenサンプル](https://codepen.io/hatena19/pen/XWKxdmp?editors=1100)
|
1
コード修正
test
CHANGED
@@ -160,18 +160,12 @@
|
|
160
160
|
|
161
161
|
@media screen and (max-width: 479px) {
|
162
162
|
|
163
|
-
.wrapper{
|
163
|
+
.wrapper, .wrapper * {
|
164
164
|
|
165
165
|
width: 150px;
|
166
166
|
|
167
167
|
}
|
168
168
|
|
169
|
-
.wrapper * {
|
170
|
-
|
171
|
-
width: 150px;
|
172
|
-
|
173
|
-
}
|
174
|
-
|
175
169
|
.main, .content {
|
176
170
|
|
177
171
|
height: 100%;
|
@@ -194,11 +188,7 @@
|
|
194
188
|
|
195
189
|
.side,
|
196
190
|
|
197
|
-
.top-left-bottom,
|
198
|
-
|
199
|
-
.content-top-right
|
191
|
+
.content-top-right {
|
200
|
-
|
201
|
-
.top-right {
|
202
192
|
|
203
193
|
height: 100px;
|
204
194
|
|