2
我有一個柔性盒帶有2個項目,direction = row。第二項的文字內容很長。我希望第二個項目與第一個項目一樣高,並且有一個滾動條。這可能嗎?柔性盒項目的極限高度
#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