IE frameBorder替代方案

时间:2012-04-03 00:33:29

标签: html css iframe internet-explorer-8 w3c-validation

对于这行代码:

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

我收到此错误:(validator.w3.org:XHTML 1.0 Transitional)

there is no attribute "frameBorder"

我正在使用frameBorder,因为IE8会在iframe上创建某种边框。在最新的Chrome / Firefox上,没关系。

还有其他W3C有效的方法可以删除IE8上的边框格式iframe吗?

3 个答案:

答案 0 :(得分:4)

只需使用CSS:

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

P.S。我假设您在iFrame标签中使用了stackoverflow作为示例?因为该网站不允许使用i-Framed似乎......

答案 1 :(得分:-1)

xhtml中的所有属性均为小写。请尝试以下操作:

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

答案 2 :(得分:-1)

由于W3C没有执行Javascript,您可以稍后使用Javascript添加该属性。

使用jQuery的示例:

$('iframe').attr("frameBorder", 0);
相关问题