Html IE 背景图片不显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14753538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 05:28:32  来源:igfitidea点击:

IE background image not showing

htmlcssbackground

提问by Jamie000012

Having a small problem where the background image is not showing in any of the IE versions (except IE 9 I believe), not sure what is going wrong, any helps/thoughts/things I could try out?

有一个小问题,在任何 IE 版本中都没有显示背景图像(我相信 IE 9 除外),不确定出了什么问题,我可以尝试任何帮助/想法/事情吗?

Kind regards

亲切的问候

http://www.trucknetuk.com/phpBB/viewforum.php?f=46It is the Michelin banner(not the small sponsor) just above the new topic button

http://www.trucknetuk.com/phpBB/viewforum.php?f=46新话题按钮正上方是米其林横幅(不是小赞助商)

background: url("./styles/Owner_Fleet_Operator_MS/theme/images/michelinback.gif") repeat-x scroll center 0 transparent;

背景: url("./styles/Owner_Fleet_Operator_MS/theme/images/michelinback.gif") repeat-x 滚动中心 0 透明;

回答by Billy Moat

Change this:

改变这个:

background: url('./styles/Owner_Fleet_Operator_MS/theme/images/michelinback.gif')repeat-x scroll center 0 transparent;

To this:

对此:

background: url('./styles/Owner_Fleet_Operator_MS/theme/images/michelinback.gif') repeat-x scroll center 0 transparent;

The difference is a space after the closing bracket and before the "repeat-x". IE is much pickier than other browsers regarding syntax.

区别在于右括号之后和“repeat-x”之前有一个空格。IE 在语法方面比其他浏览器更挑剔。

回答by keeg

Your background shorthand is wrong, transparentneeds to come first

你的背景速记错误,transparent需要先来

#page-body {
    background: transparent url("./styles/Owner_Fleet_Operator_MS/theme/images/michelinback.gif") repeat-x center 0;
    clear: both;
    padding: 4px 5px;
}

proper shorthand is : body {background:#ffffff url('img_tree.png') no-repeat right top;}

正确的简写是: body {background:#ffffff url('img_tree.png') no-repeat right top;}

Not sure what you are trying to do with the scrolldeclaration

不确定您要对scroll声明做什么

回答by Surya R Praveen

.button{
      background: transparent url('../images/backrgound.jpg') no-repeat top center;
}

CSS Standard

CSS标准

background : color URL repeat-section and position

背景:颜色 URL 重复部分和位置

JPEG Images

JPEG 图像

Check whether images are of JPEG2000, if yes, then open any image editor and save it again with proper jpeg extension

检查图像是否为JPEG2000,如果是,则打开任何图像编辑器并使用适当的jpeg扩展名再次保存