我正在使用ASP.NET模板并尝试将我的内容设置为占用窗口的整个高度,但我无法实现它。里面有一个容器和两个兄弟姐妹。将底部div设置为高度100%会导致容器溢出。将div高度设置为窗口高度
我也使用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/
添加高度:100%你的身体选择。 – Slime
对不起,小提琴不是最新的,请参阅我的编辑http://jsfiddle.net/ob1g0752/4/。 –