【发布时间】:2015-10-03 23:02:44
【问题描述】:
我是 Flexbox 的新手,我正在尝试使用它来创建具有固定页眉、固定页脚和填充页眉和页脚之间可用空间的内容区域的布局。内容区域是一个可滚动的区域,有 3 个面板(div),每个面板都有 100% 的高度。出于演示目的,我将 a、b、c(将它们称为面板 a、面板 b 和面板 c)文本放在每个面板的顶部。
在 Firefox v39 中,面板 a、b 和 c 占据了可滚动容器的整个高度。
在 Safari (v 8.0.6 (10600.6.3)) 中,每个面板的高度都比容器高一点。如果您滚动到最后一个面板(面板 c),当内容一直向下滚动时,标题“c”将不再显示。 Firefox 并非如此。
我想要的行为是 Firefox 中的行为。
这里是codepen。
<head lang="en">
<meta charset="UTF-8">
<title>Sample</title>
<style>
html, body {
height: 100%;
width: 100%;
font-size: 100%;
margin: 0px;
font-family:open-sans;
font-style: normal;
font-weight: 400;
}
*, *:before, *:after{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
}
</style>
</head>
<body>
<div style="height: 100%; width: 100%; ;display: -webkit-flex; display: flex; -webkit-flex-flow: column; flex-flow: column;">
<div style="width:100%; min-height: 50px;">
header<br>header<br>header<br>
</div>
<div style="display: -webkit-flex; display: flex; -webkit-flex-flow: column; flex-flow: column; width:100%; height: 100%; -webkit-flex: 1 1 auto; flex: 1 1 auto; -ms-flex: 1 1 auto; ">
<div style="overflow-y: auto; width:100%; height: 100%; border:red solid thin">
<div style="width:100%; height: 100%; border:green solid thin">
a
</div>
<div style="width:100%; height: 100%; border:green solid thin">
b
</div>
<div style="width:100%; height: 100%; border:green solid thin">
c
</div>
</div>
</div>
<div style=" min-height:30px; border:blue solid thin;">
footer
</div>
</div>
</body>
谢谢。
【问题讨论】:
-
那么你想要的行为是什么?火狐?
-
是的,我想要的行为是 FF。谢谢