使iframe占用垂直空间 [英] Making an iframe take vertical space
本文介绍了使iframe占用垂直空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想有一个 iframe
占用尽可能多的垂直空间,它需要显示其内容,而不是显示一个滚动条。是否有可能?
I would like to have an iframe
take as much vertical space as it needs to display its content and not display a scrollbar. Is it at all possible ?
有没有解决方法?
推荐答案
这应该将 IFRAME
高度设置为其内容的高度:
This should set the IFRAME
height to its content's height:
<script type="text/javascript">
the_height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
document.getElementById('the_iframe').height = the_height;
</script>
您可能要添加 scrolling =no$ c $
You may want to add scrolling="no"
to your IFRAME
to turn off the scrollbars.
编辑:糟糕,忘记声明 the_height
。
这篇关于使iframe占用垂直空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文