zoukankan      html  css  js  c++  java
  • 页面布局二(三栏布局)

    题目:上下高度固定,中间自适应。(移动端用的比较广泛)

    方案一:flexbox布局

      代码如下

    <style>
       html,body{
           margin:0;
           height:100%;
       }
        .layout{
            display:-webkit-flex;
            display:flex;
            -webkit-flex-direction:column;
            flex-direction:column;
            height:100%;
        }
        .header{
            height: 40px;
            background:red;
        }
        .main{
            -webkit-box-flex:1;
            -webkit-flex: 1;
            flex: 1;
            background:yellow;
        }
       .footer{
           height: 40px;
           background:green;
       }
    </style>
    <!--flexbox布局-->
    <section class="layout">
        <div class="header">header</div>
        <div class="main">
            弹性滚动区域
        </div>
        <div class="footer">footer</div>
    </section>

    方案二:表格布局

      代码如下:

    <style>
       html,body{
           margin:0;
           height:100%;
       }
        .layout{
            display:table;
            width: 100%;
            height:100%;
        }
       .layout>div{
           display:table-row;
       }
        .header{
            height: 40px;
            background:red;
        }
        .main{
            background:yellow;
        }
       .footer{
           height: 40px;
           background:green;
       }
    </style>
    <!--table布局-->
    <section class="layout">
        <div class="header">header</div>
        <div class="main">
            弹性滚动区域
        </div>
        <div class="footer">footer</div>
    </section>

    通过定位也可做到。

  • 相关阅读:
    volatile 关键字
    C++ 强制类型转换
    HTTP详解2-请求、响应、缓存
    HTTP详解1-工作原理
    C++ 基本知识
    (转)c++类的成员函数存储方式(是否属于类的对象)---一道面试题引发的思考
    C++ inline
    P1075 质因数分解
    P1085 不高兴的津津
    P5015 标题统计
  • 原文地址:https://www.cnblogs.com/yangkangkang/p/8665749.html
Copyright © 2011-2022 走看看