IE6和IE7中不显示背景图像

时间:2010-05-21 11:36:35

标签: html css

我有3个div HTML MARKUP

<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背景下没有显示请帮助我。 谢谢。

2 个答案:

答案 0 :(得分:4)

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

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

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

答案 1 :(得分:3)

当你有空的div或div只有空格时,有些浏览器(IE通常)不喜欢它。通常最好是放入non-breaking space&nbsp;)字符以确保浏览器确实认为它值得显示。

相关问题