vue最简单的三段式布局

  • Post author:
  • Post category:vue

template>
  <div class=”wrapper”>
      <!– 移动端三段式布局前置条件为在 app.vue或者index.html中给html和body,#app都加上height:100%,font-size:13.3333333vw ,然后在#app里加上font-size:16px –>
      <header></header>
      <main></main>
      <footer></footer>
  </div>
</template>
 
<style lang=”scss”>
    .wrapper{
        // wrapper盒子为主盒子height必须为100% 开始弹性盒属性  flex-direction: column为纵向布局
        // 头部和底部盒子为固定高度 给main盒子flex:1 让其沾满全屏 并附上属性overflow 这样就算内容过多他会自动开启滚动条不会影响
        // 头部盒子和底部盒子位置
        height: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        header{
            height: .8rem;
            background:pink ;
        }
        main{
            flex: 1;
            overflow-y: auto;
        }
        footer{
            height: .8rem;
            background: pink;
        }
    }
</style>
 


版权声明:本文为qq_63099565原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。