css - 在这种情况下如何设置 div 高度?

标签 css html

如何在这种情况下设置 div#wrap 高度?

<body style="height:100%;width:100%;overflow:hidden;padding:0;margin:0;">
<div id="header" style="width:100%;height:50px;z-index:5;background:blue;padding:0;margin:0;">&nbsp;</div>
<div id="wrap" style="width:100%;overflow:scroll;background:red;height:100%;padding:0;margin:0;">
<div id="content" style="width:100%;height:2000px;padding:0;margin:0;">
&nbsp;
</div>
</div>
<div id="footer" style="width:100%;height:30px;z-index:5;background:green;padding:0;margin:0;">&nbsp;</div>
</body>

最佳答案

这是您要找的吗?

http://jsfiddle.net/nkUwa/1/

在 Firefox 中尝试...我不知道如何使页眉和页脚具有固定高度,然后将包装和内容设置为框架集使用的“剩余区域”...但是您可以还将页眉和页脚设置为 position: absolute 并附加到视口(viewport)的顶部和底部,方法是使用 top: 0bottom: 0分别。

关于css - 在这种情况下如何设置 div 高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4288410/

相关文章:

html - 如何在 outlook 中更改我的 css 按钮的大小?

javascript - 动态添加新元素 Onclick 时丢失样式

css - RMarkdown : how to rotate table column headers

jquery - html 将表格单元格中的文本与不同表格单元格中的图像相匹配

html - 由于图像大小不同,Bootstrap 网格未对齐

html - 跨度文本的颜色

html - Css 输入 HTML,为什么更新宽度时绝对位置改变

html - Css 箭头(带边框)在输入类型按钮中不起作用

html - 相对于另一个图像水平对齐图像

html - 一个带有 AUTO 的 float div,然后是另一个填充其余部分的 div