html - CSS - 页眉 - 始终底部页脚和 100% 内容

标签 html css

<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-heightmax-height 值。

移除position: absolute;从你的 #wrap div.

我做了一个例子for you here .

关于html - CSS - 页眉 - 始终底部页脚和 100% 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4884636/

相关文章:

css - 将 CSS Moving Transition 应用于具有 `transform` 属性的元素

jquery - 如何让我的进度条平滑变色

css - 垂直对齐链接框中的文本,否定继承的 CSS 属性

javascript - 使用 css 和 js 动态创建六边形设计

javascript - 如何用纯 javascript 和 html 制作 Accordion

html - 具有灵活左右宽度的居中导航 - 百分比填充不起作用

javascript - 防止在移动浏览器上下载视频背景

jquery - .slideUp() 当悬停在除特定 div 以外的任何其他内容上时

jquery - 无法使用 jQuery 更新背景图像

html - 使用 CSS 平铺页面