html - html/css flex:使一个项目自身和容器按高度拉伸,其他在同一个容器中可滚动
问题描述
我想在同一个弹性容器中有两个具有不同行为的项目。第一项应该在添加内容时拉伸自己以及容器高度。
但是第二个应该适合容器的高度,并且当超过滚动条时应该出现。
flexbox可以吗?
容器中的项目是否有任何方法可以拉伸自己的高度,超过容器的高度,越过容器的边界?
<div style="display: flex; background: #f1f1f1; min-height: 100vh">
<div style="width:50%; margin:10px;background: aliceblue">
1<br>1<br>1<br>1<br>... this should stretch itself and container
</div>
<div style="width:50%; margin:10px;background: antiquewhite">
2<br>2<br>2<br>2<br>... this should be scrollable
</div>
</div>
解决方案
推荐阅读
- c - Tideman 中的投票功能(CS50 的 pset 3)
- python - 芹菜工人每个孩子的最大内存不工作
- java - Twilio 视频室 + 镀铬无头
- xcode - 将选项卡拖放到单选项卡、无选项卡栏窗口
- python - PySpark:如何将 UDF 应用于多个列以创建多个新列?
- flutter - Flutter 将数学方程转换为数学图像
- c++ - 如何在 C++ 中的 if 语句中检查 lambda 的返回值?
- c++ - 链表没有打印出正确的数据
- python - 如何从python字典中提取列表(作为dict值)并将其附加到具有字典列表的列表中?
- angular - 从 API 中检索组件数据源的数据