繁体   English   中英

CSS三列布局

[英]css three column layout

我正在尝试设置顶部,左侧,中心,右侧,底部的边框布局。 我已经看到了一些示例并进行了尝试,但是似乎都没有用。 主要问题在于左,中和右列。 我只能将两个div水平对齐,第三个div始终低于页脚。 我需要调整它的大小。 优选地,中央窗格将填充全部直到边界。

我曾尝试过向左浮动和向右浮动,但这并没有什么不同。

到目前为止,这是我尝试过的。 http://jsfiddle.net/xQVWs/2/

<body>
<div class="top-wrapper">
    <div class="content-wrapper">
        <header>
            header
        </header>
    </div>
</div>

<div class="mid-section">
    <div class="left-wrapper">
        Left Pane
    </div>
    <div class="main-content">
        Main pane
    </div>
    <div class="right-wrapper">
        right pane
    </div>
</div>

<div class="bottom-wrapper">
    <div class="content-wrapper">
        footer
    </div>
</div>

</body>

您可以在前两列中间使用float:left ,在第三列上使用float:right 我会overflow:hidden在中间列的包装器中。

http://jsfiddle.net/zer6N/1/

.mid-section
{
    background-color: blue;
    width: 100%;
    height:1000px;
    overflow:hidden;
}

.left-wrapper, .right-wrapper {
    background: #ffff00;
    height: 100%;
    min-height: 100%;
    width: 21%;
    display:block;
    float:left;
    margin:0;
}

.right-wrapper {
    background:#efefef;
    float:right;
}

.main-content {
    background-color: black;
    width: 58%;
    height: 100%;
    margin:0;
    float:left;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM