Transparent Iframe Body

CssIframeBackgroundTransparent

Css Problem Overview


I need to have a (crossdomain) iframe with dynamic width and height.

My question is, Can I create an iframe with 100% size and a transparent background that will show the parent of this iframe, behind it ?

Can I attach a css property or a transparent gif for the iframe background to make that effect ?

Thanks.

Css Solutions


Solution 1 - Css

yes you can (if i understand your question correctly)

heres the code if you have edit access to the iframe content put this in the head (of the iframe)

<style type="text/css">
 <!-- BODY {background:none transparent;}-->
 </style>

and then embed the iframe like this

<iframe src="frame.htm" allowtransparency="true">

Solution 2 - Css

By inspecting the iframe page you might find out there is color on some parts of the page. My suggestion would be to start from the highest component when adding the transparency:

html {
  background-color: transparent !important;
}

And then in the iframe element:

<iframe src="www.." allowtransparency="true">

Solution 3 - Css

This isn't tested, but iframes (any element) should have a default background of being transparent.

If that's not true, you can set them to being transparent in CSS background: transparent

If that doesn't work, you can use CSS opacity filters:
http://www.w3schools.com/Css/css_image_transparency.asp

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser345311View Question on Stackoverflow
Solution 1 - CssAtom VayalinkalView Answer on Stackoverflow
Solution 2 - CssPatrik Rikama-HinnenbergView Answer on Stackoverflow
Solution 3 - CssKerry JonesView Answer on Stackoverflow