html - 如何让左右div一直到底部?

标签 html css view

我有一个主页。在 body div 中有三个 div,一个右 div,一个左 div 和一个中心 div。在中心 div 中,我有 @renderbody 呈现特定 View 。我希望左右 div 高度一直到页脚。我怎样才能使侧面 div 与中心 div 的高度相同,一直到底部到页脚 div。

#body {
    background-color:white;
    margin-left:auto;
    margin-right:auto;
    width: auto;
    padding: 10px;
}

#body-main-left { 
    background-color:rgba(100, 100, 100, 0.1);
    float:left;
    width: 150px;
    height:auto;

}

#body-main-right {
    background-color: rgba(100, 100, 100, 0.1);
    float: right;
    width: 150px;
    height:auto;
}

#body-main-center {
    margin: 0 150px 0 150px;
}
#footer {
    clear: both;
    background-color: black;
    color: red;
}


<div id="container">
    <div id="header">
        <div id="header-banner">
            HeaderBanner image will reside here
        </div>
        <div id='cssmenu'>
            <ul>


<li class='active'>@Html.ActionLink("", "", "")</li>
            <li>@Html.ActionLink("", "", "")</li>
            <li>@Html.ActionLink("", "", "")</li>
            <li>@Html.ActionLink("", "", "")</li>
            <li>@Html.ActionLink("", "", "")</li>
            </ul>
        </div>
    </div>
    <div id="body">
        <div id="body-main-left">Left Block</div>
        <div id="body-main-right">Right Block</div>
        <div id="body-main-center">@RenderBody()</div>
    </div>
    <div id="footer">
        Footer copyright
    </div>
</div>

最佳答案

示例:

https://jsfiddle.net/9vd83rww/5/

padding-bottom: 0px; 添加到 #body 中,如下所示:

#body {
    background-color:white;
    margin-left:auto;
    margin-right:auto;
    width: auto;
    padding: 10px;
    padding-bottom: 0px;
}

关于html - 如何让左右div一直到底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32361531/

相关文章:

javascript - 关闭模态覆盖时无法隐藏消息框

javascript - 当光标离开输入框#select-or-enter-category时,此代码检查下拉列表中是否存在给定的输入

java - 在maven元素中我如何指定文件的相对路径

html - 内联div制作进度条

html - 更早地折叠 Bootstrap 响应式导航栏

android - 管理当前的 View 和 Class<?> 对象

javascript - 当我关闭 Canvas 外边栏时,背景覆盖不会消失

html - 背景在 IE 上不完全显示

android - API 11 上的 View.canScrollVertically

android - 来自 TextView (getDrawingCache) 的位图始终为 null