【问题标题】:IE frameBorder alternativeIE frameBorder替代
【发布时间】:2012-04-16 15:47:44
【问题描述】:
对于这行代码:
<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 吗?
【问题讨论】:
标签:
html
css
iframe
internet-explorer-8
w3c-validation
【解决方案1】:
由于 W3C 不执行 Javascript,您可以稍后使用 Javascript 添加该属性。
使用 jQuery 的示例:
$('iframe').attr("frameBorder", 0);
【解决方案2】:
只需使用 CSS:
<iframe width="600" height="400" style="border:none;" src="http://www.google.com"></iframe>
附言我假设您在 iFrame 标签中使用了 stackoverflow 作为示例?因为该网站不允许被 i-Framed 看起来...
【解决方案3】:
xhtml 中的所有属性都是小写的。试试这个:
<iframe width="600" height="400" frameborder="0" src="http://stackoverflow.com"></iframe>