我发现您的background
CSS 属性有问题...我将其分解
background: /* property name */
url(../img/bg-sprite.png) /* background-image */
repeat-x /* background-repeat */
0 -306px /* background-position */
bottom /* ummm... what?! */
...因此浏览器无法解析您的 CSS 属性。如果您在 Firefox 中加载这个宝贝并查看错误控制台(“工具”>“错误控制台”),您会看到以下内容:
解析“背景”的值时出错。声明被放弃。
所以我知道你在想什么......只需删除“底部”,对吗?但接下来会发生什么……
background: /* property name */
url(../img/bg-sprite.png) /* background-image */
repeat-x /* background-repeat */
/* background-position... */
0 /* x-position */
-306px /* y-position */
现在您的背景图像偏移了-306px
,它可能不在<div>
. 如果你真的很不走运,它甚至会超过底部,没有人<div>
可以看到你的背景图像。
所以尝试更多类似的东西......
background: url(../img/bg-sprite.png) repeat-x 0px bottom
或者...
background: url(../img/bg-sprite.png) repeat-x -306px bottom
......取决于你为什么首先在-306px
那里。