如何相对于页面底部定位页脚/元素?

Rol*_*and 1 css css-position sticky-footer

我试图将我的页脚放在页面底部,但收效甚微.

我只能粘贴链接,因为那里有很多CSS,我不知道我的问题在哪里.

所以这是链接:测试 ; 如果有人想帮助我,我会很感激.

编辑:现在的问题是老的URL是不存在了,但无论如何,当一个人需要一个脚注(或任何其他元素)定位到页面(所谓的底部的答案可能被认为是有效的粘页脚).

Rol*_*and 7

我最近实际上使用过这个解决方案.它工作得很好.如果页脚内部有动态内容,则可以轻松制作一个脚本,在调整大小或方向更改时会更改页脚的高度和正文上的边距.

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 100px;
}

footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100px; //same height as the margin to the bottom of the body
}
Run Code Online (Sandbox Code Playgroud)