回答編集履歴

2

コメントを受けて追記

2018/12/15 08:47

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア36117

test CHANGED
@@ -135,3 +135,63 @@
135
135
 
136
136
 
137
137
  ```
138
+
139
+
140
+
141
+ ### コメントを受けて追記
142
+
143
+ メディアクエリの例です。ウィンドウのサイズを変えてみてください。
144
+
145
+ [サンプル](http://jsfiddle.net/Lhankor_Mhy/sqe9to6d/1/)
146
+
147
+ ```css
148
+
149
+ .box-wrapper {
150
+
151
+ display: flex;
152
+
153
+ width:100%;
154
+
155
+ }
156
+
157
+
158
+
159
+ .box {
160
+
161
+ border: 1px solid black;
162
+
163
+ box-sizing: border-box;
164
+
165
+ width:100%;
166
+
167
+ height: 100px;
168
+
169
+ }
170
+
171
+ @media screen and (max-width: 768px){
172
+
173
+ .box-wrapper {
174
+
175
+ flex-flow:wrap;
176
+
177
+ }
178
+
179
+ .box {
180
+
181
+ width: 50%;
182
+
183
+ }
184
+
185
+ }
186
+
187
+ @media screen and (max-width: 480px){
188
+
189
+ .box {
190
+
191
+ width: 100%;
192
+
193
+ }
194
+
195
+ }
196
+
197
+ ```

1

質問が変更になったため追記

2018/12/15 08:47

投稿

Lhankor_Mhy
Lhankor_Mhy

スコア36117

test CHANGED
@@ -27,3 +27,111 @@
27
27
  }
28
28
 
29
29
  ```
30
+
31
+
32
+
33
+ ### 質問が変更になったため追記
34
+
35
+ できますよ!
36
+
37
+ [サンプル](http://jsfiddle.net/Lhankor_Mhy/sqe9to6d/)
38
+
39
+ ```html
40
+
41
+ <div class="box-wrapper horizontal">
42
+
43
+ <div class="box box1">1</div>
44
+
45
+ <div class="box box2">2</div>
46
+
47
+ <div class="box box3">3</div>
48
+
49
+ <div class="box box4">4</div>
50
+
51
+ <div class="box box5">5</div>
52
+
53
+ <div class="box box6">6</div>
54
+
55
+ </div>
56
+
57
+ <div class="box-wrapper pair">
58
+
59
+ <div class="box box1">1</div>
60
+
61
+ <div class="box box2">2</div>
62
+
63
+ <div class="box box3">3</div>
64
+
65
+ <div class="box box4">4</div>
66
+
67
+ <div class="box box5">5</div>
68
+
69
+ <div class="box box6">6</div>
70
+
71
+ </div>
72
+
73
+ <div class="box-wrapper vertical">
74
+
75
+ <div class="box box1">1</div>
76
+
77
+ <div class="box box2">2</div>
78
+
79
+ <div class="box box3">3</div>
80
+
81
+ <div class="box box4">4</div>
82
+
83
+ <div class="box box5">5</div>
84
+
85
+ <div class="box box6">6</div>
86
+
87
+ </div>
88
+
89
+ ```
90
+
91
+ ```css
92
+
93
+ .box-wrapper {
94
+
95
+ display: flex;
96
+
97
+ width:100%;
98
+
99
+ flex-flow:wrap;
100
+
101
+ }
102
+
103
+ .horizontal{
104
+
105
+ flex-flow:nowrap;
106
+
107
+ }
108
+
109
+
110
+
111
+ .box {
112
+
113
+ border: 1px solid black;
114
+
115
+ box-sizing: border-box;
116
+
117
+ width:100%;
118
+
119
+ height: 100px;
120
+
121
+ }
122
+
123
+ .vertical .box {
124
+
125
+ width: 100%;
126
+
127
+ }
128
+
129
+ .pair .box {
130
+
131
+ width: 50%;
132
+
133
+ }
134
+
135
+
136
+
137
+ ```