【问题标题】:Adjust Footer based on content根据内容调整页脚
【发布时间】:2011-03-08 03:05:34
【问题描述】:

我正在使用this 网站。

目标:
我想根据每一页的内容移动我的页脚。

1)如果有更多内容,那么我想将页脚放在内容之后。
2)我想把页脚固定在窗口屏幕的底部,如果下图中没有这样的内容

alt text http://www.freeimagehosting.net/uploads/e893eac88b.png

我现有的 CSS :

我目前在#content 中使用 min-height 属性将页脚保持在底部。

#footer_outer{
    width:100%;
    background:#444;
    padding:10px 0 0 0;
    margin-top:50px;
    height: 130px;
}

#footer {
    margin:0 auto;
    width:834px;
    height:auto;
    overflow:hidden;
}

#content {
    padding:5px;
    margin:0 auto;
    width:890px;
    height:auto;
    min-height:450px;
}

body {
    font-family:'Helvetica Neue', helvetica, arial, sans-serif;
    color:#757575;
    font-size:14px;
    padding:0;
    margin:0;
    background:#FAFAFA;
}

请帮助我实现我的目标。提前非常感谢。

问候, 价值

【问题讨论】:

    标签: css position footer


    【解决方案1】:

    1。使用固定位置的 div

    http://www.dailycoding.com/Posts/creating_always_visible_div_using_css.aspx

    将 CSS 更改为

    #footer {
        margin:0 auto;
        width:834px;
        height:auto;
        overflow:hidden;
        position: fixed;
        bottom: 0px;
    }
    

    2。如何将页脚保留在页面底部

    http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page

    【讨论】:

    • 感谢您的快速回复。我试过你的解决方案。但是,无论内容如何,​​这都会使我的页脚始终位于窗口屏幕的底部。所以页脚挂在中间,一些内容隐藏在页脚后面。我想要实现的是: 1)如果特定屏幕上没有太多内容(即如果内容没有引入任何滚动条),那么我想将页脚固定在窗口底部。 2)如果有很多内容并且还存在滚动条,那么我希望在最后的页脚......在内容的最后一个字下面......谢谢
    • @vatismarty,结帐matthewjamestaylor.com/blog/…
    猜你喜欢
    • 1970-01-01
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 2014-04-29
    • 2011-09-14
    • 2012-08-03
    • 2010-12-18
    • 1970-01-01
    相关资源
    最近更新 更多