I need a div
to have display: flex
, flex-direction: column
and flex: 1
. But for some reason the content of that div
gets resized.
Using display: block
does not resize the content.
body {
margin: 0;
display: flex;
flex-direction: column;
height: 100vh;
}
header {
height: 2em;
background: blue;
}
main {
background: yellow;
flex: 1;
overflow-y: auto;
/* Why display: flex resizes the articles */
display: flex;
flex-direction: column;
/* If you use display: block its working (uncomment to test)*/
/* display: block; */
}
article {
height: 15em;
border: 1px solid black;
margin: 1em;
}
footer {
background: green;
height: 3em;
}
<body>
<header></header>
<main>
<article></article>
<article></article>
<article></article>
</main>
<footer></footer>
</body>