您好,欢迎来到榕意旅游网。
搜索
您的当前位置:首页flex布局 左边固定右边自适应宽度,上边固定下边自适应高度

flex布局 左边固定右边自适应宽度,上边固定下边自适应高度

来源:榕意旅游网

两块内容

  <div class="box">
    <div class="left"></div>
    <div class="right"></div>
  </div>

1、左边宽度固定,右边宽度自适应铺满

	.box {
      display:flex;
      height:100%;
      width:100%;
    }
    .left {
      height:100%;
      width: 300px;
      background-color: #999;
    }
    .right {
      height:100%;
      flex: 1;
      background-color: #333;
    }

2.上面高度固定,下面高度自适应铺满

	.box {
      display:flex;
      height:100%;
      width:100%;
      flex-direction: column;
    }
    .left {
      height:200px;
      width: 100%;
      background-color: #999;
    }
    .right {
      width:100%;
      flex: 1;
      background-color: #333;
    }

三块内容

<div class="box">
    <div class="left"></div>
    <div class="center"></div>
    <div class="right"></div>
  </div>

上下固定高度,中间自适应铺满

	.box {
      display:flex;
      height:100%;
      width:100%;
      flex-direction: column;
    }
    .left {
      height:200px;
      width: 100%;
      background-color: #999;
    }
    .center {
      width:100%;
      flex: 1;
      background-color: #333;
    }
    .right{
      height:200px;
      width: 100%;
      background-color: #12aa23;
    }

左右固定宽度,中间自适应铺满

	.box {
      display:flex;
      height:100%;
      width:100%;
    }
    .left {
      width:200px;
      height: 100%;
      background-color: #999;
    }
    .center {
      height:100%;
      flex: 1;
      background-color: #333;
    }
    .right{
      width:200px;
      height: 100%;
      background-color: #12aa23;
    }

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- nryq.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务