2
フレックスボックスには2つのアイテム、direction = rowがあります。 2番目の項目のテキスト内容は非常に長いです。 2番目の項目は最初の項目と同じくらい高く、スクロールバーが必要です。これは可能ですか?フレックスボックスアイテムの限界高さ
#wrap { display: flex; }
#item-1 { height: 100px; background: orange; flex: 1; }
#item-2 { overflow: scroll; flex: 1; }
<div id='wrap'>
<div id='item-1'></div>
<div id='item-2'>
I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br> I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br> I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br> I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br> I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br> I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br> I would like this text to have a scrollbar, and thus not take up more height than the orange box.<br>
</div>
</div>
最も近いポスト私はis this oneを見つけましたが、答えは私の場合で動作するようには思えません。
あなたが '#アイテム-2 'に同じ固定の高さを設定したくない理由? – Dez
はい、これは重複していますが、リンクを見つけようとしています。 –
@Dezはい - 実際には、 'item-1'の高さは反応し、幅と内容に応じて変化します。 – wezten