【问题标题】:Adjust Footer Position Based On Content根据内容调整页脚位置
【发布时间】:2018-03-13 02:37:07
【问题描述】:

我想根据页面内容调整页脚的位置。如果页面内容很少,则需要在内容之后显示页脚,如果页面内容较多,则希望在窗口底部显示页脚。

我做了一个demo:这里https://stackblitz.com/edit/angular-59tthr?file=app%2Fapp.component.ts

当页面有更多内容时,页脚会粘在页面底部,这很好,但如果我切换内容,它仍然在同一位置。

是否可以在内容之后设置页脚?

【问题讨论】:

    标签: html css angular


    【解决方案1】:

    这可能会有所帮助

    我在你的演示中检查了它,它工作正常。

    .MainWrapper {
        position: relative;
        padding-bottom: 20px; /* this will be the height of your footer */
    }
    .footer {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
    }
    

    如果您的footer 高度更大,请尝试使用js 添加padding-bottom 值。

    【讨论】:

    • 谢谢你的回答给了我另一个想法。我已经更新了演示。这正是我所需要的
    • @abhilashreddy,那你到底需要什么??
    • 我得到了解决方案兄弟,如果你看这里stackblitz.com/edit/… 当页面内容很大时我希望页脚始终可见,这工作正常。如果内容很小,则页脚应该显示在内容完成的位置。
    • 好的,兄弟。 @abhilashreddy
    猜你喜欢
    • 2011-03-08
    • 2012-06-22
    • 2011-09-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-29
    • 2014-08-12
    • 2011-09-14
    相关资源
    最近更新 更多