0

白色背景围绕着我的 iframe,因为我正在从数据库中呼应这个 iframe,尽管它在除 IE8、IE9 之外的所有其他浏览器中正确显示(请检查屏幕截图)。虽然我在我的 header.php 中尝试了这个脚本,wordpress但仍然没有运气(在 js 文件夹下包含 ie6pngfix.js)。让我知道我该如何解决。

<!--[if IE 6]>
<script type="text/javascript" src="js/ie6pngfix.js"></script>
<script type="text/javascript">
DD_belatedPNG.fix('img, ul, ol, li, div, p, a, h1, h2, h3, h4, h5, h6, png, span');
</script>
<![endif]--> 

详情如下——

<div id="banner_right">
<iframe width="483" height="300" src="http://www.youtube.com/embed/EDPYq4BFHBI" frameborder="0" allowfullscreen></iframe>       
</div>

#banner_right iframe{background:url(images/bg.png) 0 0 no-repeat;padding: 20px 13px 27px;}

bg.png510X351px

正确的屏幕截图,除 IE8-9 之外的所有内容——(无白色背景) 在此处输入图像描述

不正确的屏幕截图,IE8-9 --(带白色背景) 在此处输入图像描述

4

1 回答 1

2

自己找到答案——

添加allowtransparency="true"到 iframe 代码。

<iframe width="483" height="300" src="http://www.youtube.com/embed/EDPYq4BFHBI" frameborder="0" allowtransparency="true"></iframe>

然后添加background-color:transparent;到我的 css--

#banner_right iframe{background:url(images/bg.png) 0 0 no-repeat;padding: 20px 13px 27px; background-color:transparent; }
于 2012-07-03T07:02:53.853 回答