In the following example I can't understand why I need to hide the overflow on #articles
. To me, it seems that because I have article { flex: 1 1 auto; }
that it should shrink & grow to the parent #articles
height. Help appreciated!
html, body {
height: 100vh;
overflow: hidden;
}
#container {
display: flex;
flex-direction: column;
align-items: stretch;
height: 100vh;
overflow: hidden;
width: 50%;
background-color: red;
}
#container header {
background-color: gray;
flex: 0 0 auto;
}
#articles {
display: flex;
flex: 1 1 auto;
flex-direction: row;
/* Why is this required? */
/* overflow: hidden; */
}
article {
flex: 1 1 auto;
overflow-y: auto;
min-height: 0px;
}
article + article {
background-color: blue;
}
#container footer {
flex: 0 0 auto;
background-color: gray;
}
<section id="container" >
<header id="header" >This is a header</header>
<section id="articles">
<article>Short</article>
<article id="content" >
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 />
</article>
</section>
<footer id="footer" >This is a footer</footer>
</section>