CSS固定流体(溢出:auto)-fixed layout

标签 css layout

实现这样布局的最佳方式是什么?:

+-------+  +--------------------------------------+ +-------+
| fixed |  |                                      | | fixed |
+-------+  |               fluid                  | +-------+
           |           overflow:auto;             |        
           |                                      |
           +--------------------------------------+

当滚动条太小而无法显示内容(图像等)时,我需要滚动条出现。

最佳答案

像这样的东西可以作为起点:

http://jsfiddle.net/8P4MX/1/

CSS:

body{
        padding     :0px;
        margin      :0px;
        text-align  :center;
    }

    div#container{
        height      : 100%;
        position    : relative;
        width       : 100%;
    }

    div#contents{
        background-color:#CCCCCC;
        border      : #000000 1px solid;
        clear       : none; 
        min-height  : 500px;
        margin-left : auto;
        margin-right: auto;
        overflow    : auto;
        position    : relative;
    }

    div.float{
        background-color:#CCCCCC;
        border      : #000000 1px solid;
        height      : 300px;
        position    : relative;
        width       : 150px;
    }

    div#left{
        float:left;
    }

    div#right{
        float:right;
    }

标记:

<div id="container">
    <div id="left" class="float">left</div>
    <div id="right" class="float">right</div>
    <div id="contents">fluid</div>
</div>

关于CSS固定流体(溢出:auto)-fixed layout,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5399493/

相关文章:

CSS 样式链接 : why a:link, a:visited vs just a

css - 在 Nivo Slider 中更改上一个/下一个导航的位置

java - 布局之间的淡入淡出效果

css - 如何使用 css 按行或字符数限制字符限制?

css - 通过有 Angular Material 的不同高度的 md 卡的响应网格

css - 覆盖主列和左侧边栏的静态 block (在 3 列布局中)

android - Android SlidingDrawer 中的组合处理程序

javascript - angular-loading-overlay 不显示任何内容

html - 不规则形状作为链接

html - 在 bootstrap 中对列重新排序以获得更大的显示