tags:

views:

31

answers:

2

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.

+1  A: 

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 ;)

Ventus
I tried using ajax but openx zones when loaded through ajax brake the whole site, cause of javascript body write function I guess.
dfilkovi
What format are you using? JSON or you send HTML code? If HTML is well formaten then $(#'id').html() should do the trick.
Ventus
A: 

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.

RoToRa