How to apply css to the body inside an iframe?

Posted on

Question :

I want to apply background: transparent no body that is created inside an iframe.

For example:

<iframe src=""id="frame_result_show" frameborder="0"></iframe>

Is there any way?


Answer :

It is not a solution with pure CSS, but see if it works for your specific case.

This first part in the definition of iframe allows transparency, but does not require it.

<iframe allowtransparency="true">

and in the source of iframe the transparency property is added in CSS :

<body style="background:transparent">

Now, if the contents of iframe is from third parties, I do not think there is a “clean” way to do it.


Leave a Reply

Your email address will not be published. Required fields are marked *