回答編集履歴
1
コード追記
answer
CHANGED
@@ -20,4 +20,38 @@
|
|
20
20
|
</body>
|
21
21
|
```
|
22
22
|
|
23
|
-
Bootstrapだと凝ったレイアウトにしようとするとHTMLがどうしても複雑になりますね。
|
23
|
+
Bootstrapだと凝ったレイアウトにしようとするとHTMLがどうしても複雑になりますね。
|
24
|
+
|
25
|
+
---
|
26
|
+
蛇足ですか、CSS Grid を使うとHTMLをシンプルにできて、CSSもシンプルな記述で同様の実装ができます。
|
27
|
+
|
28
|
+
```html
|
29
|
+
<div class="container-grid">
|
30
|
+
<div class="box1">
|
31
|
+
box1
|
32
|
+
</div>
|
33
|
+
<div class="box2">
|
34
|
+
box2
|
35
|
+
</div>
|
36
|
+
<div class="box3">
|
37
|
+
box3
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
```
|
41
|
+
|
42
|
+
```css
|
43
|
+
.container-grid {
|
44
|
+
display: grid;
|
45
|
+
grid-template-columns: 1fr 3fr;
|
46
|
+
}
|
47
|
+
.box1 {
|
48
|
+
background-color: green
|
49
|
+
}
|
50
|
+
.box2 {
|
51
|
+
grid-row: span 2;
|
52
|
+
background-color: red;
|
53
|
+
}
|
54
|
+
.box3 {
|
55
|
+
background-color: blue;
|
56
|
+
}
|
57
|
+
```
|