Using a iframe where I call a site from my webspace, Using one css file with body {background-color: #222}
.
The iframe src also use this CSS file. The Problem is that the body in the iframe need another background-colour.
tried
iframe>body { background-color: #other }
Any idea or suggestions?
ive used this and it works for me. (and its sooooo easy!)
in your CSS file put:
iframe { background-color:orange; }
Just change the "orange" to whatever color you need. Thats it!
Enjoy!
Remember that a Javascript can modify only properties of iframe with the same origin of the site, otherwise you'll get a Security Error.
Protocols, domains and ports must match.
In the page that the iframe contains, link another stylesheet and then change all the CSS styles that you wish to.
using Javascript We can add Background Color to Iframe
Reference w3schools
This question is similar to How to apply css to iframe content?. Basically you can use jQuery to change the CSS properties in the iframe
Edit: You may need to add that when the iframe loads:
I assume the iframe takes up a smaller portion of your site. In that case I would advice you to simply use a div with the same size of the iframe is loaded, and giving this div the proper background-color.
OR: include a style property in the source of the iframe page: