回答編集履歴
1
コード追記
answer
CHANGED
@@ -1,3 +1,23 @@
|
|
1
1
|
`display: contents;`を使うのはどうですか。(IEは非対応ですが)
|
2
2
|
|
3
|
-
[[CSS]「display: contents;」がすごい便利!ラッパーを使った実装が大きく変わるこれからのテクニック | コリス](https://coliss.com/articles/build-websites/operation/work/how-to-work-display-contents.html)
|
3
|
+
[[CSS]「display: contents;」がすごい便利!ラッパーを使った実装が大きく変わるこれからのテクニック | コリス](https://coliss.com/articles/build-websites/operation/work/how-to-work-display-contents.html)
|
4
|
+
|
5
|
+
```html
|
6
|
+
<div class="flex">
|
7
|
+
<div class="box">box1</div>
|
8
|
+
<div class="contents">
|
9
|
+
<div class="box">box2</div>
|
10
|
+
<div class="box">box3</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
```
|
14
|
+
```css
|
15
|
+
.flex {
|
16
|
+
display: flex;
|
17
|
+
flex-wrap: wrap;
|
18
|
+
}
|
19
|
+
|
20
|
+
.flex .contents {
|
21
|
+
display: contents;
|
22
|
+
}
|
23
|
+
```
|