• 多栏布局


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style >
    .content{
    padding:0px;
    margin:0px;
    border:red 1px solid;
    position:absolute;
    top:0px;
    bottom:0px;
    height:100%;
    100%;
    overflow-y:scroll;
    }
    .top{
    position:relative;
    border:#ccc 1px solid;

    }
    .left{
    height:200px;
    300px;
    background:green;
    float:left;
    }
    .right{
    height:200px;
    /* 200px;*/
    margin-left:300px;
    background:pink;
    position:relative;
    }
    .middle{
    position:relative;
    margin-top:30px;
    overflow:hidden;
    border:red 1px solid;
    }
    .left_1{
    height:200px;
    auto;
    background:pink;
    margin-right:300px;
    }
    .right_1{
    300px;
    height:200px;
    background:green;
    position:absolute;
    right:0px;
    top:60px;
    }
    .left_21{
    height:200px;
    300px;
    background:green;
    float:left;
    }
    .left_22{
    height:200px;
    300px;
    margin-left:300px;
    background:blue;
    position:absolute;
    }
    .right_21{
    height:200px;
    background:pink;
    position:relative;
    right:0px;
    margin-left: 600px;
    }
    .left_31{
    height: 200px;
    300px;
    background: green;
    float: left;
    }
    .left_32{
    height: 200px;
    background: pink;
    margin-left: 300px;
    margin-right: 300px;
    }
    .right_3{
    height: 200px;
    300px;
    background: green;
    position: absolute;
    right: 0px;
    top: 60px;
    }
    </style>
    </head>

    <body>
    <div class="content">

    <div class="top">
    <h3>左边固定右边自适应</h3>
    <div class="left"></div>
    <div class="right"></div>
    </div>
    <div class="middle">
    <h3>右边固定,左边自适应</h3>
    <div class="left_1"></div>
    <div class="right_1"></div>
    </div>
    <div class="middle">
    <h3>左边两个div固定大小,右边自适应</h3>
    <div class="left_21"></div>
    <div class="left_22"></div>
    <div class="right_21"></div>
    </div>
    <div class="middle">
    <h3>左右两个div固定大小,中间自适应</h3>
    <div class="left_31"></div>
    <div class="left_32"></div>
    <div class="right_3"></div>
    </div>
    </div>
    </body>
    </html>

    总结:多栏布局更多的适用于左侧导航栏固定的场景,比之前讲的圣杯布局写法更简单,实现的效果是一样的。

  • 相关阅读:
    [每日一题]:小猫爬山
    [每日一题]:Wannafly挑战赛1 -- Treepath
    JavaWeb学习(19): 文件的上传和下载
    [每日一题]:牛客练习赛61 A:打怪
    [十二省联考2019]春节十二响——长链剖分+堆
    BZOJ4977[Lydsy1708月赛]跳伞求生——贪心+堆+模拟费用流
    BZOJ4003[JLOI2015]城池攻占——可并堆
    BZOJ1823[JSOI2010]满汉全席——2-SAT+tarjan缩点
    BZOJ3876[Ahoi2014&Jsoi2014]支线剧情——有上下界的最小费用最大流
    BZOJ2738矩阵乘法——整体二分+二维树状数组
  • 原文地址:https://www.cnblogs.com/ryt103114/p/6196346.html
Copyright © 2020-2023  润新知