美文网首页
巧用flex实现页面布局分隔

巧用flex实现页面布局分隔

作者: AMONTOP | 来源:发表于2019-08-13 17:13 被阅读0次
    image.png
    .all-box{
      width: 100vw;
      height: 100vh;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
    .top-box{
      height: 800rpx;
      width: 504rpx;
      display: flex;
      flex-direction: column;
    }
    .bottom-box{
      width: 100%;
      flex:1;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    

    ① 设置 flex:1 为将整个all-box中给top-box的高度后 将剩下的高度给bottom-box
    ② 如果top-box与bottom-box同时设置为 flex:1,则平分高度
    ③ 如果top-box设置为 flex:1, bottom-box设置为 flex:2 , 则表示总共有三份,top-box占一份,bottom-box占两份

    相关文章

      网友评论

          本文标题:巧用flex实现页面布局分隔

          本文链接:https://www.haomeiwen.com/subject/dvybjctx.html