Iframe默认高度 [英] Iframe default height

查看:800
本文介绍了Iframe默认高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么当html内容只有20px时,iframe的默认高度是100px? p 您可以在这里查看一个例子: http://www.tulumarka.com/galerija/28497/after -beach-party --- 02072010papaya /?pid = 418319



缩略图下方有两个内嵌框架,可将内容推送到它们下方但不应该这导致他们没有任何内容的高。



我无法将静态大小设置为iframe,因为它们将动态填充横幅并需要动态调整其大小。

解决方案

IFrame无法将自己调整到其内容的高度。它们总是有一个静态高度 - 可能是一些默认高度,如果作者不这样做,浏览器会设置它。



如果iframe的内容来自同一个域作为外部内容,那么您可以使用JavaScript来调整大小。


Why does iframe have a default height of some 100px when the html content inside has only 20px?

You can view an example here: http://www.tulumarka.com/galerija/28497/after-beach-party---02072010papaya/?pid=418319

Below the thumbnails there are two iframes that push that content below them but shouldn't do that cause they have no content in them that is that high.

I cannot set static size to iframe cause they will be dynamically filled with banners and need to dynamically resize themselves.

解决方案

IFrames can't adjust themselves to the height of their content. They always have a static height - possibly some default height, that the browser sets if the author doesn't.

If the content of the iframe is served from the same domain as the "outer" content, then you can use JavaScript to adjust the size.

这篇关于Iframe默认高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆