【问题标题】:Background image doesn't show in IE7 and IE8背景图像在 IE7 和 IE8 中不显示
【发布时间】:2012-02-19 15:05:54
【问题描述】:

在我的网站http://aspspider.info/thesamy/GalleriesTest/MainPage/Main.aspx(免费托管测试)上,我有 2 张背景图片。在每个浏览器中都可以使用的主体和在 IE7、IE8 中无法使用的内容包装器。

我不明白为什么,如果正文的背景图片显示,为什么它在页面的不同区域不起作用?

这是该区域的 HTML 代码:

   <div id="Content-wrapper">

        <div id="GalleriesContent">
            <iframe scrolling="no" id="iframeBoxID" frameborder="0" class="iframeBoxClass" name="iframeBox"
                src="http://www.google.com"></iframe>
        </div>

    </div>

这里是css:

#Content-wrapper
{
    /*background-image:url('../logo/blackBackGround2.png'); <-- tired that*/
      background-image:url(../logo/blackBackGround2.png);

}

#GalleriesContent
{
    background-color:transparent;
    clear: both;
}
.iframeBoxClass
{
     background-color:transparent;
    border: 1px solid white;
    width: 100%;
    height: 550px;
}

【问题讨论】:

    标签: html css internet-explorer


    【解决方案1】:

    无论出于什么神奇的原因,IE 都会以白色背景呈现 iframe,并且必须被告知显式呈现透明背景才能显示 div 背景。该行为详细here 并且修复非常简单,只需将以下属性添加到您的 iframe 标记即可解决问题:

    allowTransparency="true"
    
    e.g.
    
    <iframe allowTransparency="true"></iframe>
    

    【讨论】:

      【解决方案2】:

      尝试在 CSS 中添加背景重复

      background-repeat: repeat-y;
      

      【讨论】:

      • 背景图片在那里,只是由于某种原因被
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-17
      • 1970-01-01
      相关资源
      最近更新 更多