Css 页脚中的全宽背景图像

Css 页脚中的全宽背景图像,css,wordpress,footer,Css,Wordpress,Footer,我正在使用960gs(在我的本地环境中),我将此CSS代码插入我的footerdiv: ## style.css #footer{ background:url("images/footer.png") repeat-x scroll top transparent; height: 130px; width:100%; overflow:hidden; } ## footer.php <div id="footer"> &

我正在使用960gs(在我的本地环境中),我将此CSS代码插入我的
footer
div:

## style.css

#footer{
    background:url("images/footer.png")  repeat-x scroll top transparent; 
    height: 130px; 
    width:100%; 
    overflow:hidden;
}

## footer.php

<div id="footer">   
    <div id="nav" class="container_12">  </div>
    <div id="endfooter" class="container_12">
        <div id="copyright" class="grid_3 alpha"> </div>  
        <div id="design" class="grid_3 omega">  </div>  
    </div> <!-- endfooter -->
</div> <!-- end footer -->
##style.css
#页脚{
背景:url(“images/footer.png”)重复-x滚动顶部透明;
高度:130像素;
宽度:100%;
溢出:隐藏;
}
##footer.php

问题是页面没有以全宽显示
footer
div,背景覆盖整个div。它只以960px显示图像。我做错了什么?

我花了一段时间才意识到你想做什么。您正在尝试将背景图像缩放,对吗?你不能这么做,至少在CSS2中是这样。背景图像不可缩放。可以平铺它们(重复),但不能缩放它们。如果要缩放图像,必须使用
标记

如果您愿意依赖CSS3标准,您可以使用


我不能保证
背景大小
,但w3schools确实声称拥有良好的浏览器支持。

图像的容器有多大?尺寸是:320px x 192px。那你为什么要尝试使用960px图像?如果我尝试创建一个960x120的图像,在上面的代码中,我应该得到比我想要的结果吗?我想要一个全宽的页脚,而不是960px的页脚。我忘了。奇怪的是,这只发生在我在本地工作时,当我使用index.html运行项目时。页脚全宽。谢谢你的帮助。但是,为什么代码的初始部分(在我的第一篇文章中)在index.html上工作,而不在本地工作?有什么不同?我可能在html(footer.php)上做错了什么。我不能给出任何解释,我把背景图像换成了背景色,结果是一样的。颜色无法100%把握页脚。css代码的第一个错误是图像的高度。原始图像高度为192px,而不是132px;所以页脚现在是全宽的,但不在页脚的底部
#footer{background:url(“images/footer.png”)repeat-x滚动中心顶部透明;宽度:100%;高度:192px;位置:绝对;溢出:隐藏;底部:0;左:0;右:0;
@MikeD位置:绝对是问题,我也面临同样的问题
#footer{
    background:url("images/footer.png")  repeat-x scroll top transparent; 
    background-size:100% 130px;
    height: 130px; 
    width:100%; 
    overflow:hidden;
}