by Karen StevensonFebruary 9, 2010

IE iFrame Insanity

After I spent THREE HOURS trying to figure out why IE insists on rendering a white background for an empty iframe, Nate pointed this little gem out to me.

IE has default values for iframes. Yes they do. And the default is to put an opaque background and an inset border on iframes that will ignore any attempt you make to change the iframe background color or border using css. So if you put 'background-color:transparent' into your css for the iframe element it will have no effect. That's right IT WILL IGNORE YOUR CSS!

To fix it you have to do this:

  
<iframe allowtransparency="true" frameBorder="0"></iframe>
  

See the documentation for this stupid behavior here

- http://msdn.microsoft.com/en-us/library/ms533072%28VS.85%29.aspx - http://msdn.microsoft.com/en-us/library/ms533770%28VS.85%29.aspx