简体   繁体   English

IE7和IE8中不显示背景图像

[英]Background image doesn't show in IE7 and IE8

On my site http://aspspider.info/thesamy/GalleriesTest/MainPage/Main.aspx (free hosting for test), I have 2 background images. 在我的网站http://aspspider.info/thesamy/GalleriesTest/MainPage/Main.aspx (免费托管测试),我有2个背景图像。 The body that works in every browser and a content-wrapper that doesn't work in IE7, IE8. 在每个浏览器中工作的主体和在IE7,IE8中不起作用的内容包装器。

I can't understand why, if the background img of the body shows, why it doesn't work in different areas on the page? 我无法理解为什么,如果身体的背景img显示,为什么它在页面上的不同区域不起作用?

This is the HTML code of the area: 这是该地区的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>

and here is the css: 这是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;
}

For whatever magical reason IE renders iframes with a white background and has to be told to explicitly render a transparent background in order for your div background to show. 无论出于什么神奇的原因,IE渲染具有白色背景的iframe,并且必须被告知要显式渲染透明背景以便显示div背景。 That behavior is detailed here and the fix is quite simple, simply add the following attribute to your iframe tag and it should fix the issue: 这种行为被详细这里和修复非常简单,只需将以下属性添加到您的iframe标签,它应该解决这个问题:

allowTransparency="true"

e.g.

<iframe allowTransparency="true"></iframe>

尝试在CSS中添加背景重复

background-repeat: repeat-y;

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

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