IE frameBorder alternative

随声附和 提交于 2019-12-08 19:49:31

问题


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 ?


回答1:


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...




回答2:


All attributes in xhtml are in lowercase. Try this:

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



回答3:


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

Example using jQuery:

$('iframe').attr("frameBorder", 0);


来源:https://stackoverflow.com/questions/9985658/ie-frameborder-alternative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!