我有一个flexbox,其中有两个项目,方向为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>
我找到的最接近的帖子是这个,但答案似乎在我的情况下不起作用。
#item-2
中设置相同的固定高度吗? - Dezitem-1
的高度是自适应的,并且可以根据其宽度和内容而变化。 - wezten