# adding background color to iframe

Page 1 of 1

## 2 Replies - 5155 Views - Last Post: 21 August 2012 - 02:09 AM

Reputation: 0
• Posts: 37
• Joined: 03-July 12

# adding background color to iframe

Posted 19 August 2012 - 09:40 AM

hi everyone
i've been trying to set background color to my iframe....but it takes the color of the host page...i also tried changing the background of the source page of the iframe....but got the same result....any help is highly appreciated.

This post has been edited by mshadow: 19 August 2012 - 09:41 AM

Is This A Good Question/Topic? 0

## Replies To: adding background color to iframe

### #2 Atli

• D.I.C Lover

Reputation: 3758
• Posts: 6,078
• Joined: 08-June 10

## Re: adding background color to iframe

Posted 19 August 2012 - 09:49 AM

Is the source of the iframe on the same domain as the page that's showing it?

There are some restrictions on how you can use iframes. If the sources doesn't belong to the same domain, you're pretty much locked out of making any changes to it. If it is, however, then you can access the iframe document through Javascript and make whatever changes are needed.

### #3 goatsy

Reputation: 4
• Posts: 20
• Joined: 19-August 12

## Re: adding background color to iframe

Posted 21 August 2012 - 02:09 AM

Place this code in your main index.html document:

<iframe src="iframe.html" width="400px" height="600px" frameborder="0"></iframe>

And this one for your "iframe.html":
<body bgcolor="#ff3000">
text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here text here </body>