Html – Change body background color in an iframe using one css file

csshtmliframe

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?

Best Solution

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:

<head>
    <style>body {background-color:#COLOR}</style>
</head>