【发布时间】:2018-08-15 14:16:11
【问题描述】:
我做了一个小的codepen 来证明我的问题。
在 chrome 中它按预期工作,但在 Firefox 中溢出:隐藏样式似乎不起作用。它将我的内容延伸到整个页面。
您可以在 js-section 中注释掉 innerHTML,您会看到布局在没有内容的情况下工作。
我也玩过 min-height: 0,但没有任何结果。
html
<div class="l-page">
<header class="page-header"></header>
<main class="page-content">
<div class="page-content__inner">
<div class="boxes">
<div class="box">{{content}}</div>
<div class="box">{{content}}</div>
</div>
<div class="actionbar"></div>
</div>
</main>
</div>
css
.l-page{
overflow: hidden;
height: 100vh;
width: 100vw;
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
}
.page-header{
height: 100px;
background-color: green;
}
.page-content{
flex: 1;
background-color: wheat;
padding: 50px;
display: flex;
}
.page-content__inner{
flex: 1;
display: flex;
flex-direction: column;
}
.boxes{
flex: 1;
display: flex;
}
.box{
overflow-y: scroll;
width: 100%;
background-color: whitesmoke;
padding: 20px;
flex: 1;
}
.box+.box{
margin-left: 20px;
}
.actionbar{
height: 50px;
background-color: red;
}
更新 操作栏的高度可以变化。它只是设置为 50px 以简化操作。
【问题讨论】:
标签: html css firefox flexbox overflow