参考文章:https://segmentfault.com/a/1190000010510291
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>flex</title>
<style type="text/css">
body{
padding: 0;
margin: 0;
-webkit-overflow-scrolling: touch; //有回弹效果
}
.container{
height: calc(100vh - 50px);
background-color: black;
display: flex;
flex-direction: column;
}
.header{
width: 100%;
height: 100px;
background-color: #e77c8e;
}
.main{
width: 100%;
flex: 1;
overflow-y: auto;
background-color: #2bae85;
}
.footer{
width: 100%;
height: 100px;
background-color: #7a7374;
}
#h4500{
height: 4500px;
width: 100%;
}
</style>
</head>
<body>
<div class="container">
<div class="header">header</div>
<div class="main">
<div id="h4500">
</div>
</div>
<div class="footer">footer</div>
</div>
</body>
</html>
网友评论