Below is my code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
.container {
height: 100vh;
display: flex;
flex-direction: column;
}
main {
flex-grow: 1;
overflow: auto;
}
header {
height: 10vh;
background: #ddd;
}
footer {
height: 10vh;
background: #ddd;
}
</style>
</head>
<body>
<div class="container">
<header>header</header>
<main>
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p> <--if increase the height of main, like add more <p>, the height of header narrows, but height of footer does not narrow
</main>
<footer>
footer
</footer>
</div>
My question is: if the height of main do not over 80vh, the height of main is as expected, Once the height of main over 80vh, the height of main narrows, but height of footer unchanged, Why it this happen?