开发者

Iframe default height

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 开发者_Python百科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.


I'm not sure in 100% but there in loaded document into iframe I could see that body and div style have height: 100% maybe that's the problem.

But do you really need to use iframes? According to W3C you shouldn't. If you wish to put dynamically some content, why not to use Ajax? You already do that by jQuery script. So just modify it and put content into div, not iframe.

Don't use frames, use Ajax ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜