浏览器底部的页脚,除非我滚动

ama*_*dev 4 html css footer sticky-footer

我有一个奇怪的页脚问题.

http://jsfiddle.net/YGAvd/

如果我展开或缩小窗口,页面底部的云将粘在浏览器窗口的底部.但是当我向下滚动时,页脚会在页面中间卷起.这在我的任何其他页面上都不是问题,因为它们在滚动条出现之前都适合900x600窗口.

有没有办法让我的页脚保持在窗口的底部,即使我滚动(所以它总是在内容下),而不会弄乱共享CSS文档的所有其他页面的代码?

rle*_*mon 5

在页脚CSS规则中更改'position:absolute;' 到'位置:固定;'

你可能还需要玩一些其他def,但这有效.

看看这个

这是我的最终页脚规则

footer {
    position: fixed;
    color: black;
    width: 100%;
    height: 4.6em;
    background-image: url(http://img.photobucket.com/albums/v410/justice4all_quiet/bottom_clouds.jpg);
    background-repeat: repeat-x;
    background-color: e0e0e0;
    z-index: -999;
    overflow: hidden;
    bottom: 0px;
}
Run Code Online (Sandbox Code Playgroud)