2012-03-21 31 views
4

我有一个奇怪的页脚问题。页脚底部的浏览器,除了当我滚动

http://jsfiddle.net/YGAvd/

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

有没有办法让我的页脚在窗口底部,甚至当我不搞乱代码为所有共享的CSS文件的其他页面滚动(所以它始终会下的内容有)?

回答

5

在页脚CSS规则中改变'position:absolute;'到'position:fixed'

你可能还得玩一些其他的def,但这个工程。

check it out

这是我最后的页脚规则

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; 
} 
+0

非常感谢! – amandathewebdev 2012-03-21 21:23:37

1

不要把背景图像中的页脚....使其身体背景图片!

然后让你的身体标记看起来像这样:

body { 
    line-height: 1; 
    overflow: auto; 
    background-image: url(http://img.photobucket.com/albums/v410/justice4all_quiet/bottom_clouds.jpg); 
    background-repeat: repeat-x; 
    background-position:bottom center; 
    background-attachment:fixed; 
    background-color: #b1ceff; 
    font: normal 95% Sathu, Verdana, Arial, Tahoma; 
    text-align: center; 
    height: 100%; 
} 

不要忘记从你的页脚的图像删除代码。此外,删除页脚中的背景颜色以避免任何问题。

+0

我试过这个,它创造奇迹! – NotJay 2012-03-21 21:20:34

相关问题