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