回答編集履歴
3
サンプルリンク追加
answer
CHANGED
@@ -38,4 +38,7 @@
|
|
38
38
|
flex: auto;
|
39
39
|
}
|
40
40
|
}
|
41
|
-
```
|
41
|
+
```
|
42
|
+
[CodePenサンプル](https://codepen.io/hatena19/pen/pobWyVE?editors=0110)
|
43
|
+
|
44
|
+

|
2
コード修正
answer
CHANGED
@@ -8,8 +8,8 @@
|
|
8
8
|
<p>住んでるところ</p>
|
9
9
|
<p>好きな国</p>
|
10
10
|
</div>
|
11
|
-
<div class="flex
|
11
|
+
<div class="flex gap-10">
|
12
|
-
<p>年齢</p>
|
12
|
+
<p class="age">年齢</p>
|
13
13
|
<p>好きな食べ物</p>
|
14
14
|
<p>趣味</p>
|
15
15
|
</div>
|
@@ -22,6 +22,7 @@
|
|
22
22
|
span {
|
23
23
|
&.flex {
|
24
24
|
display: flex;
|
25
|
+
flex-wrap: wrap;
|
25
26
|
}
|
26
27
|
&.flex-direction {
|
27
28
|
flex-direction: column;
|
@@ -29,11 +30,12 @@
|
|
29
30
|
&.gridgap-10 {
|
30
31
|
gap: 10px;
|
31
32
|
}
|
33
|
+
}
|
34
|
+
|
32
|
-
|
35
|
+
.age {
|
33
|
-
|
36
|
+
flex: 0 0 100%;
|
34
|
-
|
37
|
+
@media screen and (min-width: 450px) {
|
35
|
-
|
38
|
+
flex: auto;
|
36
|
-
}
|
37
39
|
}
|
38
40
|
}
|
39
41
|
```
|
1
質問が変更されたのでコード修正
answer
CHANGED
@@ -1,10 +1,39 @@
|
|
1
|
-
提示のコードだと <div class="flex flex-direction gap-10"> の中身が縦並びだが、
|
2
|
-
|
1
|
+
質問が変更されたのでそれに合わせてコード修正しました。
|
3
2
|
|
3
|
+
```html
|
4
|
+
<div class="flex">
|
5
|
+
<p>名前</p>
|
6
|
+
<div class="flex flex-direction gap-10">
|
7
|
+
<div>
|
8
|
+
<p>住んでるところ</p>
|
9
|
+
<p>好きな国</p>
|
10
|
+
</div>
|
11
|
+
<div class="flex flex-direction-sm gap-10">
|
12
|
+
<p>年齢</p>
|
13
|
+
<p>好きな食べ物</p>
|
14
|
+
<p>趣味</p>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</div>
|
18
|
+
```
|
19
|
+
|
4
|
-
```
|
20
|
+
```scss
|
21
|
+
div,
|
5
|
-
|
22
|
+
span {
|
6
|
-
|
23
|
+
&.flex {
|
7
|
-
|
24
|
+
display: flex;
|
8
25
|
}
|
26
|
+
&.flex-direction {
|
27
|
+
flex-direction: column;
|
28
|
+
}
|
29
|
+
&.gridgap-10 {
|
30
|
+
gap: 10px;
|
31
|
+
}
|
32
|
+
&.flex-direction-sm {
|
33
|
+
flex-direction: column;
|
34
|
+
@media screen and (min-width: 450px) {
|
35
|
+
flex-direction: row;
|
36
|
+
}
|
37
|
+
}
|
9
38
|
}
|
10
39
|
```
|