<body>
<div id="wrap">
<div id="header">
HEADER
</div>
<div id="inner-wrap">
<div id="content">
CONTENT
</div>
</div>
<div id="footer">
FOTTER
</div>
</div> </body>
和 CSS:
html { height:100%; max-height:100%; }
body {
margin:0;
padding:0;
height:100%;
max-height: 100%;
}
#wrap {
min-height:100%;
height: 100%;
position:relative;
}
* html #wrap { height:100% }
#inner-wrap {
padding-bottom:50px;
min-height: 100%;
}
#inner-wrap:after {
content:" ";
display:block;
clear:both;
}
* html #inner-wrap {
height:100%;
}
#header
{
width: 100%;
background-color: #C0C0C0;
height: 16px;
color: White;
text-align: center;
position: relative;
top:0px;
}
#footer
{
width: 100%;
background-color: #C0C0C0;
height: 50px;
position:absolute;
bottom: 0;
color: White;
text-align: center;
}
#content
{
width: 1000px;
height: 100%;
background-color: #F5FDEC;
margin: 0 auto 0 auto;
}
问题:
我该怎么做: HEADER top 16px, 内容动态 100% 高度, 页尾的页脚
如果我将 100% 给 inner-wrap DIV,它们在页脚之后是空白。
谢谢
最佳答案
你有太多的高度:
从您的选择器中删除 min-height
和 max-height
值。
移除position: absolute
;从你的 #wrap
div.
我做了一个例子for you here .
关于html - CSS - 页眉 - 始终底部页脚和 100% 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4884636/