zoukankan      html  css  js  c++  java
  • 使用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>
  • 相关阅读:
    伟东云学堂—几何画板学习
    京北鲤鱼----创客教育
    几何画板学习网站
    快乐的搬运工
    少儿编程网
    科技学堂 Arduino轻松学
    跟张老师学硬件arduino板
    科技学堂 Arduino传感器入门
    巧办网
    项目:git+gitlab+jenkins+ansible上线网站
  • 原文地址:https://www.cnblogs.com/phermis/p/6763348.html
Copyright © 2011-2022 走看看