使iframe透明 [英] making the iframe transparent

查看:134
本文介绍了使iframe透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

如何创建透明框架集?

使iframe trasparent但它显示在我的firefox浏览器中的白色。我已经使用以下代码为iframe

I am trying to make the iframe trasparent but it showing white color in my firefox browser. I have used the following code for the iframe

<iframe id="frontimg" src="slider/slide.html" width="950" height="370" border="0" scrolling="no" allowTransparency="true"></iframe>

在我想要的html文件中,我把这个代码放在head标签中:

And in my desired html file i have put this code in head tag for styling:

<style type="text/css">
    html,
    body {
        background-color: transparent;
    }
</style>


推荐答案

除非iframe里面的内容没有背景颜色,你是运气不好。如果它在你自己的域中,你可以设置背景透明,如果它是从iframe(在你的iframe头)调用:

You can't style iframes from the outside. Unless the content inside the iframe have no background color, you are out of luck. If it's inside your own domain, you may set the background transparent if it's being called from inside an iframe (in your iframe head):

<script type="text/javascript">
 if (window!= window.top) { // inside iframe
   document.body.style.backgroundColor = 'transparent';
   // or document.body.style.background = 'none';
 }
</script>

这篇关于使iframe透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆