tags:

views:

27

answers:

3

Hi,

I have a page with a background-image that is set in a stylesheet

body {background: url(blabla) center top no-repeat;

When I put an iframe in the page I get the background image repeated in the iframe, how can I avoid this? allowtransparency="yes" makes it go away in FireFox but not IE.

<iframe class="iframeclass" allowtransparency="yes" src="/site.html">

Thanks in advance.

Edit, it doesn't go away in FireFox either.

+1  A: 

does this help: http://webforumz.com/html-xhtml-and-css/5965-problem-with-iframe-background-image-in.htm

i.e. try changing to:

body {background: transparent url(blabla.jpg) center top no-repeat;

Moin Zaman
+2  A: 

If the top page and the page in the iframe both load the same css it's no wonder they have the same background. Does the page inside the iframe ever appear outside of it? If not, you could just overwrite the style for the iframe page by adding <style> body { background: 0; } </style> In the head of the page that's inside the iframe, but after the css file has been linked..

Litso
A: 

Is setting a class on one or each of the bodies an option? Then just use the selector to only set your background once (if that's what you want)

pleunv
In that case he'd have to edit the stylesheet (which he preferred not to, see question) or add another style element or stylesheet, which my answer handles more efficiently.
Litso