IE frameBorder alternative
Asked Answered
H

3

6

For this line of code:

<iframe width="600" height="400" frameBorder="0" src="http://stackoverflow.com"></iframe>​

I got this error: (validator.w3.org : XHTML 1.0 Transitional)

there is no attribute "frameBorder"

I'm using frameBorder because IE8 creates some kind of border on iframes. On latest Chrome/Firefox it's fine.

Is there any other, W3C valid, way to remove border form iframe on IE8 ?

Harte answered 3/4, 2012 at 0:33 Comment(1)
possible duplicate of IE 8 iframe border problemRinse
R
5

Simply use CSS:

<iframe width="600" height="400" style="border:none;" src="http://www.google.com"></iframe>

p.s. I assume you used stackoverflow in your iFrame tag as an example? Because the site doesn't allow being i-Framed it seems...

Rheo answered 23/5, 2012 at 13:40 Comment(0)
L
-1

Since W3C isn't excecuting Javascript, you could add the attribute later on with Javascript.

Example using jQuery:

$('iframe').attr("frameBorder", 0);
Landy answered 23/5, 2012 at 10:59 Comment(1)
Hacking around the test doesn't make it valid.Duleba
C
-2

All attributes in xhtml are in lowercase. Try this:

<iframe width="600" height="400" frameborder="0" src="http://stackoverflow.com"></iframe>​
Carmelo answered 3/4, 2012 at 23:22 Comment(1)
frameborder isn’t allowed by the validator either.Recumbent

© 2022 - 2024 — McMap. All rights reserved.