<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
  	
html,body,ul{
  height:100%;
}
body{
  margin:0
}
ul{
  display:flex;
  flex-direction:column;
  padding:0;
  margin:0;
}
li{
  background:yellow;
  margin:0;
  list-style:none;
  height:20px;
}
li:first-child,
li:last-child{
  height:50px;
  background-color: green;
}
li:nth-child(2){
  flex:1;
  overflow: scroll;
}
  </style>
</head>
<body>
<ul>
  <li>1</li>
  <li>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  	<p>hello</p>
  </li>
  <li>3</li>

</ul>
</body>
</html>

flexbox常用布局上下固定,中间滚动

相关文章:

  • 2022-12-23
  • 2021-11-08
  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-12-19
  • 2022-02-14
相关资源
相似解决方案