How to not show a background-image in an iframe when parent page has one?
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 e开发者_JAVA技巧ither.
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..
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;
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)
精彩评论