html - 页脚在底部 文本在中间

标签 html css footer

无论内容中有多少文本,我都试图将页脚保持在底部。 我究竟做错了什么?布局是:

    .top{
    width:500px;
    height:100px;
    background-color:black;
}

.content{
    width:500px;
    min-height:100%;
    position:relative;
}

.footer{
    width:500px;
    height:100px;
    background-color:blue;
    position:absolute;
    bottom:0;
}

<div class="top"></div>
<div class="content"></div>
<div class="footer"></div>

http://jsfiddle.net/RDuWn/68/

问候,西蒙

最佳答案

我认为你必须像这样使用 position:fixed:

.footer{
    width:500px;
    height:100px;
    background-color:blue;
    position:fixed
    bottom:0;
}

DEMO

关于html - 页脚在底部 文本在中间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14983651/

相关文章:

jquery - 用按钮扩展div,显示隐藏在div中的更多信息

CSS block 级链接颜色覆盖 Chrome 中的默认值

html - 4 列页脚不为移动设备堆叠

html - 让图片正确并排显示

html - 我怎样才能让我的 BG 包装器一直加载到页面下方,或者显示在内容之前?

html - 悬停 HTML 上的 CSS3 中心三 Angular 形

css - Fontello - 如何向现有元素添加字体?

javascript - 附加的 div 不是 DOM 的一部分

javascript - 如何验证用户在选择表单中选择的内容

html - 仅在页面底部的最后一页打印页脚元素