如何修复 IE7 和 IE8 中隐藏在其他 div 后面的 div 背景图像
我有以下代码...
HTML:
<div id="gallery">
<div id="slideshow">
<div> <!-- SLIDE 1 -->
//slide content
</div>
<div> <!-- SLIDE 2 -->
//slide content
</div>
</div>
</div>
CSS:
#gallery {
width: 940px;
height: 317px;
background: transparent url("../images/banner_bg.png") no-repeat scroll right 0;
position: relative;
}
我已经尝试过使用 .png .gif 和 .jpg 图像作为背景,结果相同。
问题是在 IE7 中,幻灯片 div 覆盖了图库 div 中的背景图像。我知道这一点是因为如果我将幻灯片 div 的不透明度设置为 80 或更低,我可以看到背景图像闪闪发光。
该页面在 Firefox、Chrome、Safari 和 Opera 中看起来很棒。这只是 IE7 和 IE8 中的问题。
有人知道如何解决这个问题吗?我花了几个小时在谷歌上搜索这个问题,并尝试了我遇到的所有方法,无论听起来多么不可能。我一直无法找到解决方案。
(请帮忙,这让我发疯)
I have the following code...
HTML:
<div id="gallery">
<div id="slideshow">
<div> <!-- SLIDE 1 -->
//slide content
</div>
<div> <!-- SLIDE 2 -->
//slide content
</div>
</div>
</div>
CSS:
#gallery {
width: 940px;
height: 317px;
background: transparent url("../images/banner_bg.png") no-repeat scroll right 0;
position: relative;
}
I have tried this with .png .gif and .jpg images for background, same result.
The problem is that in IE7 the slideshow div covers the background image from the gallery div. I know this because if I set the opacity of the slideshow div to 80 or less I can see the background image shining through.
The page looks great in firefox, chrome, safari and opera. This is only a problem in IE7 and IE8.
Does anybody know how to fix this? I have spent hours googleing this and have tried everything I came across no matter how unlikely it sounded. I have not been able to find a solution.
(Please help, this is making me insane)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了问题...
幻灯片 div 将背景颜色设置为黑色,我假设这是 IE 解释,因为
1)其他浏览器中没有发生这种情况
2)我在代码中找不到将背景颜色设置为黑色的任何地方。
CSS 修复很简单:
我必须在末尾添加 !important,否则它会覆盖我的样式。
I found the problem...
The slide divs were getting their background color set to black and I am assuming that this is an IE interpretation because
1) it was not happening in other browsers and
2) I could not find anywhere in the code where it would have set the bg color to black.
The CSS fix was simple:
I did have to add the !important to the end or it would overwrite my style.