html - 为什么我的弹性项目垂直溢出其父项?我怎样才能让弹性项目高度随父项缩小和增长?
问题描述
我flex: 1
用来尝试获取我的弹性框中的最后一项来填充父项的剩余高度。它适用于所有 div,直到我们到达 table 元素,一旦它获得大量内容,它就会大量溢出。我怎样才能告诉桌子适合其容器的高度?
.fit-to-screen {
display: flex;
flex-direction: column;
height: calc(100vh - 98px);
.fit-to-screen-padding {
padding: 4%;
height: 100%;
display: flex;
flex: 1;
flex-direction: column;
.table-container {
flex: 1;
height: 100%;
.table {
display: flex;
flex: 1;
height: 100%;
flex-direction: column;
border: 1px solid;
width: 100%;
min-width: 445px;
max-width: 1459px;
}
}
}
<div class="fit-to-screen">
<div class="fit-to-screen-padding">
<div class="item-1"></div>
<div class="item-2"></div>
<div class="table-container">
<div class="table"></div>
</div>
</div>
</div>
解决方案
推荐阅读
- python - python与sqlite3 db一起工作,从db中保存、更新和检索文本
- c# - 我应该在哪里存储网格数据;在静态变量中,它是自己的类,还是一个类中的所有网格类型?
- regex - 匹配 bash 脚本中的单词模式
- python - Pandas groupby:按学期分组
- sql - 在列中显示选择结果
- sql - 仅当班次位于两个日期时,如何获取班次日期一条记录?
- google-app-engine - `go run *.go` 中的文件如何在没有导入的情况下访问函数?
- javascript - 使用 jQuery 重新加载页面时保留值
- laravel - 如何在axios响应中传递数组中的数据
- android-studio - 无法运行 libGDX 示例项目