简体   繁体   English

IE6和IE7中未显示背景图片

[英]Background image is not displaying in IE6 and IE7

I Have 3 divs HTML MARKUP 我有3个divs HTML标记

<div class="top-content-wrapper"></div>
<div id="content-wrapper">
</div>
<div class="bottom-content-wrapper">
</div>

Applied CSS on 已应用CSS

.top-content-wrapper {
background:url("img/white-box-top-bg.gif") no-repeat scroll left top transparent;
height:10px;
margin:0 auto;
padding:0 30px;
width:686px;
}
#content-wrapper {
background:url("img/white-box-middle-bg.gif") repeat-y scroll left top transparent;
margin:0 auto;
padding:10px 25px 70px;
width:696px;
}
.bottom-content-wrapper  {
background:url("img/white-box-bottom-bg.gif") no-repeat scroll left top transparent;
height:53px;
margin:0 auto;
padding:0 30px;
width:686px;
}

In all major browsers its working fine but in IE6 and iE7 the background is not displaying please help me. 在所有主要的浏览器中,它都能正常工作,但在IE6和iE7中,背景没有显示,请帮帮我。 Thank you. 谢谢。

Not sure, but it may be that you have a wrong order of parameters for the backgrounds. 不确定,但可能是背景参数顺序错误。 The proper way to sort them is this one: 对其进行排序的正确方法是:

background: transparent url("img/white-box-middle-bg.gif") repeat-y scroll left top;

Also, as Sam152 said in the comments, it may be the case that you don't have content in your divs, so they won't show in some browsers at all. 另外,正如Sam152在评论中所说,可能是您的div中没有​​内容,因此它们根本不会在某些浏览器中显示。

Some browsers (IE generally) don't like it when you have empty divs or divs with only whitespace in them. 当您有空的div或仅包含空格的div时,某些浏览器(通常是IE)不喜欢它。 Generally it's better to chuck in a non-breaking space ( &nbsp; ) character to make sure that the browser actually thinks it's worth displaying. 通常,最好插入一个不间断空格&nbsp; )字符,以确保浏览器实际上认为值得显示。

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

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