【发布时间】:2015-02-26 23:31:31
【问题描述】:
我正在使用 ASP.NET 模板并尝试将我的内容设置为占据窗口的整个高度,但我无法实现。我有一个容器和 2 个兄弟 div 里面。将底部 div 设置为高度 100% 会导致它溢出容器。
我也在使用 Bootstrap。
我只能将它的高度百分比降低到更低的值,但没有更好的方法吗? 我添加了一个屏幕截图和一个小提琴: http://jsfiddle.net/ob1g0752/
HTML:
<div style="height:100%; width:100%; border-style:solid; border-width:2px; position:absolute;">
<div style="margin:5px; width:100%; border-style:solid; border-width:2px; border-color:pink;">
test
</div>
<div style="height:100%;width:100%; border-style:solid; border-width:2px; margin:5px; border-color:yellow;">
test
</div>
</div>
<footer style="display:block;">footer</footer>
CSS:
body
{
min-height:100%;
min-width:100%;
}
html
{
height:100%;
}
编辑
抱歉,我发布了旧版本的小提琴,这是更新的。观察黄色边框溢出容器。
http://jsfiddle.net/ob1g0752/4/
【问题讨论】:
-
将 height:100% 添加到您的身体选择器。
-
对不起,小提琴不是最新的,请参阅我的编辑jsfiddle.net/ob1g0752/4。
标签: html css twitter-bootstrap height