iframe background color

  • rdub
  • Born
  • Born
  • rdub
  • Posts: 4

Post 3+ Months Ago

How do I change the iframe background color? It looks like it is #ffffcc by default.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2391
  • Loc: Edinburgh, Scotland

Post 3+ Months Ago

You can change the background color of an iframe using CSS:

Code: [ Select ]
iframe {
  background-color: red;
}
  1. iframe {
  2.   background-color: red;
  3. }


However, once the iframe's source page loads, the background-color becomes irrelevant: the loaded page overrides it.
  • rdub
  • Born
  • Born
  • rdub
  • Posts: 4

Post 3+ Months Ago

Where will this code be placed?
  • katana
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2391
  • Loc: Edinburgh, Scotland

Post 3+ Months Ago

Either externally in your CSS stylesheet, or similar to the following:

Code: [ Select ]
<html>
<head>
<style type="text/css">
iframe#test {
    background-color: blue;
}
</style>
</head>
<body>
<iframe id="test" src="http://www.google.co.uk"></iframe>
</body>
</html>
  1. <html>
  2. <head>
  3. <style type="text/css">
  4. iframe#test {
  5.     background-color: blue;
  6. }
  7. </style>
  8. </head>
  9. <body>
  10. <iframe id="test" src="http://www.google.co.uk"></iframe>
  11. </body>
  12. </html>
  • rdub
  • Born
  • Born
  • rdub
  • Posts: 4

Post 3+ Months Ago

Any idea why it wouldn't work?
  • Tedjn
  • Graduate
  • Graduate
  • Tedjn
  • Posts: 238
  • Loc: On a computer...obviously

Post 3+ Months Ago

Make sure the background of the page you're including isn't something other than the color you want.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 69 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.