Forum Moderators: open

Message Too Old, No Replies

iframe transparency

         

xt0ne

8:19 pm on May 31, 2006 (gmt 0)

10+ Year Member


i understand

<iframe allowtransparency="true">

works, but there's a code i used to use that made part of the scroll bar transparent too. you could put the color code in and it would make the background and scroll bar color transparent. if i remember right it was in a style tag..

<iframe style="?">

i appreciate it..

RonPK

9:21 pm on May 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How can a background be transparent? I mean, there is nothing behind the scroll bar. Wouldn't that show the inside of your monitor?

xt0ne

12:35 am on Jun 1, 2006 (gmt 0)

10+ Year Member



no, it's like allowtransparency but this code sets a certain color to be transparent inside the iframe.

so if the color of the scroll bar track was the same as the background, they'd both be transparent.

xt0ne

12:57 am on Jun 1, 2006 (gmt 0)

10+ Year Member



I found it..

The solution is this:

1. First Give your Iframe the allowtransparency="true" tag.
2. Make sure the source page's content has NO background color specified... not in the page itself, and not in any stylesheet linked to the page! This will make the body color pure white.
3. Add this to your iframe tag:
style=filter: chroma(color="#FFFFFF");

Step 1 and 2 makes the iframe transparent in netscape/mozilla/firefox. As long as the page has no other background specified, the transparency works... but if you specify a background color, the transparency is lost.

Step 3 makes it work in Internet explorer, IE's filter:chroma nukes the white background. That means you must make sure no other part of your page (or at least nothing in that iframe) has pure white, or it will be made invisible. That's pretty easy, if something is even slightly differently colored (for example #FFFFFD) then it won't be transparent.

So the example code:

<IFRAME src="anything.htm" frameborder="No" style="FILTER: chroma(color=#FFFFFF)" allowtransparency="true">
</IFRAME>

And "anything.htm" must not have any bgcolor specified in its body tag, or in a style section, or in any CSS that it's linked to.

Hope this was helpful to someone other than me.

[edited by: tedster at 4:05 am (utc) on June 1, 2006]
[edit reason] fix formating [/edit]

tedster

4:04 am on Jun 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the research and the report. I'm sure it will help others -- these threads hang around for a long time.

RonPK

6:28 am on Jun 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, thanks, xt0ne.

This shatters my idea of how frames work. I always considered an iframe to be a hole in the parent window, but rendering engines obviously think different.