views:

18218

answers:

5

How do I remove the border from an IFrame embedded in my web app? An example of the IFrame is:

<IFRAME src="myURL" width=300" height="300">Browser not compatible. </IFRAME>

I would like the transition from the content on my page to the contents of the IFrame to be seemless, assuming the background colors are consistent. The target browser is IE6 only and unfortunately solutions for others will not help.

+48  A: 

Add the frameBorder attribute (note the capital ‘B’).

So it would look like:

<iframe src="myURL" width=300" height="300" frameBorder="0">Browser not compatible.</iframe>
David Basarab
please edit this answer to indicate that a CAPITAL B on Border is required to make this work in IE.
scunliffe
@scunliffe: There you go. :)
Mathias Bynens
+4  A: 

In addition to adding the frameborder attribute you might want to consider setting the scrolling attribute to "no" to prevent scrollbars from appearing.

<IFRAME src="myURL" width=300" height="300" frameborder="0" scrolling="no">Browser not compatible. </IFRAME> 
xenox
+23  A: 

After going mad trying to remove the border in IE7, I found that the frameBorder attribute is case sensitive.

You have to set the frameBorder attribute with a capital B.

<iframe frameBorder="0" ></iframe>
Adam
correct, in IE it must be capital B.
scunliffe
This is completely ridiculous! Good catch though. SO saved me many hours of trouble again :)
Alex
Too crazy... thanks!
Wayne Kao
it would be a lifesaver if were the correct answer, because it mentions the capital **B**.
KARASZI István
+1  A: 

Is the capital B in frameBorder="0" still relevant? I have not been able to reproduce having a frame border when using frameborder="0", using IE 6, 7, 8, 9. I have also started using the HTML5 doctype <!DOCTYPE html>

Has it been fixed at some point?

teejae