(某些)背景图像不会出现在IE7或IE8中

时间:2011-10-04 20:29:04

标签: css internet-explorer class background-image

CSS:

#content {
    width:630px;
 }

.all_friends {

background:url(../img/friends.png) no-repeat;
margin-left:15px;
height:123px;
width:615px;
padding-bottom:20px;
}


.all_awards {
background:url(../img/awards2.png)no-repeat;
height:126px;
width:581px;
padding-bottom:20px;
margin-left:20px;
}

HTML:

<div id=content>
  <h4>Friends</h4>
   <p>Friends description text</p>
   <div class="all_friends"></div> 

  <h4>Awards</h4>
   <p>Awards description text</p>
   <div class="all_awards"></div>
</div>

在IE7 / 8中,我只是不明白为什么“朋友”内容块中的图像显示在IE7 / 8中,但是在“奖励”内容块中,没有图像显示。我不想将奖励图像作为内联“img”标记,(因为它在其他内容块中工作),但这只是IE将显示它的方式。有谁知道我怎么解决这个问题?我之前在IE中遇到过这个问题,我想在标记中添加img标签,但是它在一个具有相同规则(例如图像和大小)的内容块中工作没有意义并且没有显示出来在另一个。我检查了herehere以及here,我修改了我的标记,但没有任何效果。

这很疯狂。你试图将你的CSS和HTML分开,有时浪费很多时间试图做这些事情只是为了发现它们无法完成....(咆哮)

谢谢!

1 个答案:

答案 0 :(得分:4)

尝试在background:url(../img/awards2.png)no-repeat;之间添加空格。除非图像网址错误,否则这是我在两个样式块之间可以看到的唯一相关差异。