I'm trying to create 2 column full height design by using flexbox. When I add scrolling to whole middle part then I have a strange behavior. It seems that flex-grow/stretch doesn't grow/stretch other items if parent container has a scrollbar.
Here is my fiddle. Code also given below:
html, body {
height: 100%;
}
#container {
display: flex;
flex-direction: column;
height: 100%;
width: 50%;
background-color: red;
}
#container header {
background-color: gray;
}
#container section {
flex: 1 1 auto;
overflow-y: auto;
min-height: 0px;
}
#container footer {
background-color: gray;
}
aside {
width : 100px;
background-color: blue;
}
article{
width: 100%;
display:flex;
flex-direction: column;
}
article > div{
flex: 1 1 auto;
}
#content {
display:flex;
}
<section id="container" >
<header id="header" >This is a header</header>
<section id="content">
<aside>
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
test<br />
</aside>
<article id="article" >
<div>
This is the content that
<br />
With a lot of lines.
<br />
With a lot of lines.
<br />
This is the content that
<br />
With a lot of lines.
<br />
<br />
This is the content that
<br />
With a lot of lines.
<br />
<br />
This is the content that
<br />
With a lot of lines.
<br />
</div>
<footer id="footer" >This is a page footer</footer>
</article>
</section>
<footer id="footer" >This is a footer</footer>
</section>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…