【发布时间】:2017-01-12 23:44:28
【问题描述】:
澄清:这不会重复Chrome / Safari not filling 100% height of flex parent上的问题
我的问题与容器不随内容拉伸有关。否则容器在没有内容的情况下伸展得很好。问题是当我真正开始将内容倒入容器以增加其高度时。
“主”元素应该随着内容进行拉伸,但目前还没有这样做。我的代码如下:
html, body {
height: 100%;
min-height: 100%;
margin: 0;
padding: 0;
}
header, footer {
height: 40px;
background: #fafafa;
display: block;
}
#page-wrapper {
display: flex;
flex-direction: column;
background: lightpink;
min-height: 100%;
}
main {
display: flex;
background: darkred;
flex: 1;
flex-direction: row;
}
#reader {
flex: 1;
background: orange;
}
#splitcontent {
background: lightblue;
width: 200px;
}
<div id="page-wrapper">
<header>header</header>
<main id="content">
<article id="reader">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</article>
<article id="splitcontent">
</article>
</main>
<footer>footer</footer>
</div>
【问题讨论】:
-
在 Firefox 中是可以的。铬是错误的
-
是的,它也需要在 chrome 中工作......
-
我在 Firefox 和 Chrome 中的行为是一样的。
-
Check 2:nd sample in dupe link,它完全符合您的要求
-
在这里咬牙切齿......我想我会远离 flexbox,直到大多数浏览器达成某种协议。它对我来说仍然有点“实验性”。 Flexbox 应该很简单 - 从逻辑上讲,我的代码应该可以工作。
标签: html css google-chrome flexbox