css 头部和底部固定,中间高度自适应,出滚动条 css代码

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
  <title>Title</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
  </style>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
</head>
<body>
<div id="app" style="display: flex;flex-direction: column;height: 100vh;">
  <div style="height: 60px;position: fixed;top: 0;width: 100vw;background: red">45646</div>

  <div style="overflow: auto;margin: 60px 0">
    <div v-for="n in 100">{{n}}</div>
  </div>

  <div style="height: 60px;position: fixed;bottom: 0;background: red;width: 100vw;"></div>
</div>
<script>
var app = new Vue({
  el: '#app',
  data: {
    message: 'Hello Vue!'
  }
})
</script>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qinkaiyuan94/article/details/83343891