Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transparent Iframe Body

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.

like image 383
user345311 Avatar asked Jun 17 '10 17:06

user345311


People also ask

Can you make an iframe transparent?

A transparent iframe can be made by setting its background to transparent. And, the allowtransparency attribute of “iframe” is to be set as “true”.

How do I change the background color in iframe?

document. body. style. backgroundColor = 'white'; }, delayInMilliseconds);

Are iframes still used?

Inline frames (shortened to iFrames) were introduced in the late 1990s by Microsoft, making it one of the oldest HTML tags. From a technology perspective, it's ancient. That said, there are still some legitimate use cases for iFrames.

Are iframes supported in HTML5?

The <iframe> element is still valid in HTML5. Depending on what exact interaction you need there might be different APIs. For example there's the postMessage method which allows you to achieve cross domain javascript interaction.


1 Answers

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"> 
like image 169
Atom Vayalinkal Avatar answered Sep 28 '22 09:09

Atom Vayalinkal