次のレイアウトを入れ子にすることなくflexで構築することはできますか?
例:
ネストせずにフレックスとレイアウトのこの種を建てすることが可能ですか?純粋に、このような構造で:
<div class="long">
</div>
<div class="short">
</div>
<div class="short">
</div>
<div class="short">
</div>
<div class="short">
</div>
次のレイアウトを入れ子にすることなくflexで構築することはできますか?
例:
ネストせずにフレックスとレイアウトのこの種を建てすることが可能ですか?純粋に、このような構造で:
<div class="long">
</div>
<div class="short">
</div>
<div class="short">
</div>
<div class="short">
</div>
<div class="short">
</div>
確かに。いいえ、その後、あなたはボックスが動的コンテンツに調整したい場合は
* {
box-sizing: border-box;
}
.container {
display: flex;
flex-flow: column;
flex-wrap: wrap;
max-height: 200px;
max-width: 320px;
}
.long {
background-color: red;
border: thin solid darkgray;
width: 100px;
height: 200px;
}
.short {
background-color: blue;
border: thin solid darkgray;
width: 100px;
height: 100px;
}
<div class="container">
<div class="long"></div>
<div class="short"></div>
<div class="short"></div>
<div class="short"></div>
<div class="short"></div>
</div>
*
下記参照、およびスクリプトなし。 – LGSon
フレックスボックスでは、容器に固定された高さを設定することができます。 https://stackoverflow.com/q/34480760/3597276 –