everyone, I have encountered a bit of an incomprehensible bug in css, although I found a solution, I still want to ask what is causing it。thanks.
#app {
height: 100vh;
overflow: auto;
display: flex;
flex-direction: column;
}
#box {
display: flex;
flex-direction: column;
min-height: 400px;
height: 1800px;
padding-bottom: 50px;
}
#flex1 {
flex: 1;
}
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app">
<div id="box">
<div id="flex1">
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
<h1>123</h1>
</div>
<button>confirm</button>
</div>
</div>
</body>
</html>
question1: height: 1800px;
no effect ?
question2: even removed height: 1800px;
, padding-bottom: 50px;
is also no effect?
The solution to all problems is
#box {
flex-shrink: 0;
}
why?