zoukankan      html  css  js  c++  java
  • 自适应布局备忘

    1、两栏布局  侧边栏宽度固定,主内容宽度自适应

    <div class="layout">
            <div class="layout_aside">侧边栏宽度固定</div>
            <div class="layout_main">主内容栏宽度自适应</div>
        </div>
    .layout:after{ clear: both; content: " "; display: table;}
    .layout_aside,.layout_main { float: left;}
    .layout { padding-left: 210px;}
    .layout_main { width: 100%; background: red;}
    .layout_aside { width:200px; margin-left: -210px; background: green;}

    效果是:

    ---------------------------------------------------------------------------------------

    2、两栏布局 侧边栏固定在右边 左侧为主内容

    <div class="layout">
            <div class="layout_main">主内容栏宽度自适应</div>
            <div class="layout_aside">侧边栏宽度固定</div>
        </div>
    .layout:after{ clear: both; content: " "; display: table;}
    .layout { padding-right: 210px;}
    .layout .layout_main { width:100%; float: left; background:red;}
    .layout .layout_aside {margin-right: -210px; width:200px; float: right; background: green;}

    效果是:

    -----------------------------------------------------------------------------------------------

    3、三栏布局 两个侧边栏分别固定在左右,中间为主体内容栏

    <div class="layout">
            <div class="layout_aside layout-aside-left">侧边栏宽度固定</div>
            <div class="layout_main">主内容栏宽度自适应</div>
            <div class="layout_aside layout-aside-right">侧边栏宽度固定</div>
        </div>
    .layout:after{clear: both; content:" "; display: table;}
    .layout_aside,.layout_main {float: left;}
    .layout {padding: 0 210px;}
    .layout_main {width:100%; background: green;}
    .layout_aside {width:200px;}
    .layout-aside-left { margin-left: -210px; background: red;}
    .layout-aside-right {margin-right: -210px; float: right; background: blue;}

    实际每个分栏都需要填些内容,不然会看不到效果,还以为不好用。

    ------------------------------------------------------------------------------------------------------------------------

    以上内容产考http://www.cnblogs.com/lyzg/p/5160570.html#undefined 感谢作者

  • 相关阅读:
    【面试题037】两个链表的第一个公共结点
    【面试题036】数组中的逆序对
    【面试题035】第一个只出现一次的字符
    WebService 序列化和反序列化
    Cookies设置,获取,删除
    Session 存储和失效方式
    Render 使用
    批量保存 htm
    js属性prototype的使用
    水晶报表 IE设置
  • 原文地址:https://www.cnblogs.com/junwu/p/5166975.html
Copyright © 2011-2022 走看看