1
シアンボックスがフレックスラップに設定されているため、この例では画面幅が小さいときに青と赤のボックスが折り返されると予想しました。ネストされたフレックスコンテナでフレックスラップが動作しない
しかし、それは起こっていません。なぜこれは機能しないのですか?ここで
はコードです:
.foo,
.foo1,
.foo3 {
color: #333;
text-align: center;
padding: 1em;
background: #ffea61;
box-shadow: 0 0 0.5em #999;
display: flex;
}
.foo1 {
background: green;
width: 200px;
flex: 1 1 100%;
}
.foo2 {
background: pink;
display: flex;
padding: 10px;
}
.foo3 {
background: cyan;
flex-wrap: wrap;
}
.bar1,
.bar2 {
background: blue;
width: 50px;
height: 30px;
}
.bar2 {
background: red;
}
.column {
display: flex;
flex-direction: column;
flex-wrap: wrap;
background: orange;
height: 150px;
}
<div class="column">
<div class="foo1"></div>
<div class="foo">
<div class="foo2">
<div class="foo3">
<div class="bar1"></div>
<div class="bar2"></div>
</div>
</div>
</div>
<div class="foo1"></div>
</div>
次のリンクで詳細をご参照ください:http://codepen.io/anon/pen/vxExjL
感謝を!これは機能します。私はこれを正しい答えとして受け入れました。私の実際の問題はこれより複雑で、flex-dir:columnを使用する必要があります。私の場合、flex-dir:行の解決策はうまくいかないでしょう。しかし、これは良い答えです!ありがとう! –
@ louis.luo、あなたがまだ気づいていない場合に備えて、ちょうど参考になります。「カラムラップ」に固有のフレックスボックス問題がいくつかあります。個人的には、「列巻き」はプライムタイムの準備ができているとは思わない。それは私が通常「行」ベースのレイアウトに固執する理由の1つです。 –
詳細については:[**ここ**](http://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-幅)、[**ここ**](http://stackoverflow.com/questions/39095473/flexbox-wrong-width-calculation-when-flex-direction-column-flex-wrap-wrap)、[**ここ**](http://stackoverflow.com/questions/39617628/height-of-flex-container-not-working-properly-in-safari)と[**ここ**](http://stackoverflow.com/questions/34480760/the-it-possible-for-a-flexbox-container-that-wraps-in-rows-to-align)です。 –