Welcome to WebmasterWorld Guest from 54.166.117.130

Forum Moderators: incrediBILL

background color for an iframe

   
11:11 am on Aug 27, 2005 (gmt 0)

5+ Year Member



i've read a few messages on this topic but havent been able to get a working solution. how can we change the background color of an iframe from its default white to black(or any other color) using an inline style tag within the iframe tag.
would be glad if anyone can help.
2:18 pm on Aug 27, 2005 (gmt 0)

5+ Year Member



Well whatever page you are feeding through the iframe is where you are going to need change the background properties. unless you have like a default value set in your .css for HTML {} or BODY {} though I'm not even sure of the reliability of that.

Basically whatever page you're loading into the iframe will control the background color.

P.S. - iframes suck in soooooo many ways ;)

cheers!

4:49 pm on Aug 27, 2005 (gmt 0)

5+ Year Member



Changing the background color of the
iframe
element won't have any effect unless the
body
element of the framed page has its
background
property set to
transparent
.

In some situations JavaScript can be used to alter the background color or to set it to transparent. It would help if you described what page you are framing and why.

6:52 am on Aug 28, 2005 (gmt 0)

5+ Year Member



i'm using iframes because frames divide the entire browser. thereby changing the look of the page esp when resolutions are different. i tried using allowtransperancy=true within the iframe tag but its not working. I'm using CSS for the body tag. will try again by setting the background property within the body tag of the framed page to transperant. thanks for the replies.
3:44 am on Aug 31, 2005 (gmt 0)

10+ Year Member



have you considered using a <div> layer to do the same thing? i have only used iframes a couple times but those were strictly because i needed to have dynamic content load on a static page while still being able to control certain physical aspects of the dynamic page such as width and height...

you have access to all the scrollbar features etc... that an iframe has except you can not refresh/reload layers independently of the rest of the site, therefore you can not target a page to load to the div... you can however, use javascript to turn visibility on or off very easily...

goodluck

4:02 pm on Aug 31, 2005 (gmt 0)

5+ Year Member



i've found a solution. Thanks for all the help.
11:28 am on Sep 10, 2005 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Won't you please share your discovery, for the benefit of all who read this thread?
4:54 pm on Oct 3, 2005 (gmt 0)

10+ Year Member



Hi I had a look at this, and thanks to Aapo Laitinen
who mentioned to set the background to transparent on the body of the document contained IN the iframe, I found a solution.

Just setting the background-color doesn't seem to work, but creating a small gif of the appropriate color and setting the background-image: (whatevercolourwant.gif) will do the trick.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month