`

简单的iframe自动适应高度

    博客分类:
  • html
 
阅读更多
简单的iframe自动适应高度
2010-07-12 15:29
代码:

<div class="min_outer">
<iframe id="iFrame1" name="iFrame1" scrolling="no" width="500" onload="this.height=iFrame1.document.body.scrollHeight" frameborder="0" src="index.html"></iframe>
</div>

css高度
.min_outer{height:auto;width:500px;}

不出现滚动条

在 iframe 加上 scrolling="no"
<iframe id="iFrame1" name="iFrame1" scrolling="no" width="500" onload="this.height=iFrame1.document.body.scrollHeight" frameborder="0" src="index.html"></iframe>

出现滚动条
在 iframe 加上 scrolling="yes"

<iframe id="iFrame1" name="iFrame1" scrolling="yes" width="500" onload="this.height=iFrame1.document.body.scrollHeight" frameborder="0" src="index.html"></iframe>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics