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

#1 mshadow  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • 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.
Was This Post Helpful? 1
  • +
  • -

#3 goatsy  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • 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>


0_0
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1