• 使用absolute布局


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <style>
            *{
                margin:0;
                padding:0;
            }
            .top {
                width: 100%;
                height: 40px;
                background: #000;
                color:#fff;
                position:absolute;
                top:0;
                /*以上设置是重点必须的*/
                text-align:center;
                line-height:40px;
            }
            .bottom{
                width:100%;
                height:40px;
                background:#000;
                color:#fff;
                position:absolute;
                bottom:0;
                /*以上设置是重点必须的*/
                text-align:center;
                line-height:40px;
            }
            .mainBox{
                width:100%;
                position:absolute;
                top:40px;
                bottom:40px;
                /*以上设置是重点必须的*/
            }
            .mainBox .leftBox{
                height:100%;
                width:200px;
                float:left;
                margin-bottom:40px;
                overflow: auto;
                /*以上设置是重点必须的*/
                border:6px solid green;
                -webkit-box-sizing: border-box;
                -moz-box-sizing: border-box;
                box-sizing: border-box;
                text-align:center;
                line-height:40px;
            }
            .mainBox .rightBox{
                height:100%;
                margin-left:220px;
                /*以上设置是重点必须的*/
                border:6px solid crimson;
                -webkit-box-sizing: border-box;
                -moz-box-sizing: border-box;
                box-sizing: border-box;
                overflow: auto;
                text-align:center;
                line-height:40px;
            }
            .left1{
                background-color: #0088cc;
                width: 100%;
                height: 60%;
            }
            .left2{
                background-color: #CCCCCC;
                width: 100%;
                height: 40%;
            }
        </style>
    </head>
    <body>
    <div class="top">顶部,高度40px</div>
    <div class="mainBox">
        <div class="leftBox"><!--左盒子,固定宽度200px,高度自适应铺满屏幕剩余高度-->
            <div class="left1"></div>
            <div class="left2"></div>
        </div>
        <div class="rightBox">右盒子,距离左盒子20px,高度自适应宽度自适应铺满屏幕剩余高度</div>
    </div>
    <div class="bottom">底部,高度40px</div>
    </body>
    </html>
  • 相关阅读:
    C# base64编码、解码
    C#异常重试通用类Retry
    C#操作Control异步工具类
    Notepad++的Json格式化插件
    CG 标准函数库
    Unity 几种优化建议
    基于Unity的Profiler性能分析
    Time.timeScale、游戏暂停
    Lua 中的string库(字符串函数库)总结
    Lua 日志
  • 原文地址:https://www.cnblogs.com/phermis/p/6763348.html
Copyright © 2020-2023  润新知