gpt4 book ai didi

html - 限制 flexbox 元素的高度

转载 作者:太空狗 更新时间:2023-10-29 14:44:37 24 4
gpt4 key购买 nike

<分区>

我有一个包含 2 个元素的 flexbox,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 ,但答案似乎不适用于我的情况。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com