繁体   English   中英

IE6和IE7中未显示背景图片

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

我有3个divs HTML标记

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

已应用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;
}

在所有主要的浏览器中,它都能正常工作,但在IE6和iE7中,背景没有显示,请帮帮我。 谢谢。

不确定,但可能是背景参数顺序错误。 对其进行排序的正确方法是:

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

另外,正如Sam152在评论中所说,可能是您的div中没有​​内容,因此它们根本不会在某些浏览器中显示。

当您有空的div或仅包含空格的div时,某些浏览器(通常是IE)不喜欢它。 通常,最好插入一个不间断空格&nbsp; )字符,以确保浏览器实际上认为值得显示。

暂无
暂无

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

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