简体   繁体   English

侧面DIV高度未延伸100%

[英]Side DIV not extending 100% in height

I have a layout that has a side menu bar and then the main content displayed on the right side. 我有一个带有侧面菜单栏的布局,然后在右侧显示了主要内容。 The layout and functionality work just fine except for one minor detail - 布局和功能工作正常,除了一个小细节-

In some cases, there isnt enough content to fill the entire screen and when that happens the DIV containing the main content does not stretch and fill the remainder of the screen creating a visual difference as seen in the screenshot. 在某些情况下,没有足够的内容填充整个屏幕,并且在这种情况下,包含主要内容的DIV不会拉伸并填充屏幕的其余部分,从而在屏幕截图中产生视觉差异。 I tried manipulating various attributes and putting in dummy content etc but could not find a clean solution. 我尝试操纵各种属性并放入虚拟内容等,但是找不到干净的解决方案。 I am hoping someone can help. 我希望有人能提供帮助。 I am using Twitter Bootstrap 3.x 我正在使用Twitter Bootstrap 3.x

I have included the CSS for the main section, ideally, I would like this white background to fill the screen upto the footer. 我已经在主要部分添加了CSS,理想情况下,我希望此白色背景将屏幕填充到页脚。

/*
 * Main content
 */

.main {
    padding: 20px;
    background-color: #fff;
    border-left: 1px solid #dae3e9;
    height: 100%;
    box-shadow: -3px 3px 3px -2px #f1f1f3;
}

屏幕截图显示DIV没有扩展100%

I have also created a fiddle with my code, the visual is a little messed up because the output is trapped inside a frame - but here it is anyway - 我还用我的代码创建了一个小提琴,由于输出被困在框架内,因此视觉效果有些混乱-但无论如何这里都是 -

Dont use min-width: 100% ; 不要使用min-width: 100% ; on your #wrap. 在您的#wrap上。 Basically solves the problem. 基本上解决了问题。

But i want the footer to still be at bottom etc... Fiddle 但我希望页脚仍在底部等... Fiddle

Added: 添加:

.main::before {
    content: "";
    position: absolute;
    z-index:-1;
    display: block;
    width: 100%;
    margin-left: -20px;
    height: 100vh;
    border: 1px solid black;
    background-color:white;
}

Suggestion: clean up your code. 建议:清理代码。 you don't need that much html code the design your doing. 您不需要那么多的html代码即可进行设计。 I't will be hell for any one who want to edit or change it at a later stage. 对于以后想要编辑或更改它的人来说,我不会是地狱。

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

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