使用flex实现页面布局

页面:

<div class="container">
        <div class="section">
          <!--头部-->
          <div class="header">
            <h2>
                header
            </h2>
          </div>
          <!--头部结束-->
          <!--中间部分-->
          <div class="content">
              <!--中间部分的左侧部分-->
              <div class="content_left">
                左侧导航
              </div>
              <!--中间部分的左侧部分结束-->
              <!--中间部分的右侧部分-->
              <div class="content_right">
                  右侧内容显示区域
              </div>
              <!--中间部分的右侧部分结束-->
          </div>
          <!--中间部分结束-->
          <!--尾部-->
          <footer class="footer">
            <h2>
                footer
            </h2>
          </footer>
          <!--尾部结束-->
        </div>
    </div>
页面样式:
           html, body{
             height: 100%;
             margin: 0;
             padding: 0;
           }
           .container{
              width: 100%;
              height: 100%;
           }
           .section{
             height: 100%;
             display: flex;
             flex-direction: column;
           }
           .content{
                width: 100%;
                flex: 1;
                flex-direction: row;
                display: flex;
                background-color: rgb(2,138,201);
           }
           .content_left{
                display: flex;
                background-color: antiquewhite;
                width: 200px;
                height: 100%;
            }
           .content_right{
                display: flex;
                width: 300px;
                background-color: cadetblue;
                height: 100%;
                flex:1;
            }
           .header, .footer{
             background-color: rgb(72,82,94);
           }
           .header{
             height: 90px;
           }
           .footer{
             height: 80px;
           }



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值