简体   繁体   English

为什么IE7没有背景图片?

[英]Why is there no background image in IE7?

The background image is missing in ie7; ie7中缺少背景图片; only ie7 has an issue.只有ie7有问题。

The site is here http://www.competition4ct.com/ .该网站在这里http://www.competition4ct.com/

This is the call I'm using for the background image:这是我用于背景图像的调用:

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

Why isn't the background image appearing?为什么没有出现背景图片?

You seem to be missing the url in front of your file name.您似乎缺少文件名前面的url It should be:它应该是:

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

Notice that I've also used background-image here, not background .请注意,我在这里也使用了background-image ,而不是background You can use the background shortcut, then it would look something like this:您可以使用background快捷方式,然后它看起来像这样:

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

It's also more usual to put a background on the body tag, although I'm sure the html tag will work in most cases as well.body标签上放置背景也更常见,尽管我确信html标签在大多数情况下也可以使用。

Not sure if that's causing the problem, but you need to put "url" in front of the parentheses.不确定这是否会导致问题,但您需要将“url”放在括号前。 May not hurt either to make the body have the background.也可以不伤害使身体有背景。 Finally, just the 'background' property might require more input, as you set several things at once (and you're only trying to do the bg image).最后,只是 'background' 属性可能需要更多输入,因为您一次设置了几件事(并且您只是尝试制作 bg 图像)。 So:所以:

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

or或者

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

For more info see:有关更多信息,请参阅:

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

Let us know if any of these solutions solve your problem.让我们知道这些解决方案是否能解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM