How to apply css to body inside an iframe?

Asked

Viewed 760 times

3

I want to apply background: Transparent on the body that is created within an iframe.

For example:

<iframe src="http://www.meusiteteste.com.br" id="frame_result_show" frameborder="0"></iframe>

Is there any way?

  • Javascript only.

  • Have some example ai @bfavaretto ?

  • I don’t even think that works, there are security restrictions if the domains don’t match.

1 answer

6

It’s not a pure CSS solution, 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 at the source of iframe in addition to CSS the ownership of transparency:

<body style="background:transparent">

Now, if the contents of iframe is third party, I believe there is no "clean" way to do.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.