为什么IE7中没有背景图像?

时间:2011-05-03 21:46:08

标签: html css background background-image internet-explorer-7

ie7中缺少背景图像;只有ie7有问题。

该网站位于http://www.competition4ct.com/

这是我用于背景图片的电话:

html { background : ("source-file.png");}

为什么不出现背景图片?

2 个答案:

答案 0 :(得分:8)

您似乎错过了文件名前面的url。它应该是:

body {background-image: url(source-file.png);}

请注意,我在这里使用了background-image,而不是background。您可以使用background快捷方式,然后它看起来像这样:

body {background: transparent url(source-file.png) left top no-repeat;}

body标记上添加背景也更为常见,但我确信html标记在大多数情况下也适用。

答案 1 :(得分:1)

不确定是否会导致问题,但您需要将“url”放在括号前面。也许不会伤到让身体有背景。最后,只需“背景”属性可能需要更多输入,因为您一次设置了几个(并且您只是尝试执行bg图像)。所以:

html { background-image : url("source-file.png"); }

body { background-image : ("source-file.png");}

有关详细信息,请参阅:

http://www.w3schools.com/css/pr_background.asp

如果有任何解决方案可以解决您的问题,请告诉我们。