0

Now I am faced very weird html problem.

When I make html code as below the div has some height (maybe 20px or 18px ...)

<html>
    <body>
        <div>
            <img>
        </div>
    </body>
</html>

But when i put this div in iframe as below, it has no height (0px)

<html>
    <body>
        <iframe>
        #document
            <html>
                <body>
                    <div>
                        <img>
                    </div>
                </body>
            </html>
        </iframe>
    </body>
</html>

It seems difference is only whether putting div into iframe or not.

But the second code's div has no height. I don't know why div has no height.

Please let me know what is problem and how to fix it.

Thanks

LarAng
  • 1,255
  • 3
  • 18
  • 28
  • Did you set a height on your iframe? – Walker Boh Nov 14 '17 at 19:37
  • @WalkerBoh, I didn't set height on iframe. now I made this as new html code, but the original problem was from some complex html code, so it iframe has some other contents, so it has some height, but the problem is same. now I have made narrow this problem, so I found that the problem is same in this simple code. – LarAng Nov 14 '17 at 19:42
  • Set a height/width on the iframe – Walker Boh Nov 14 '17 at 19:43
  • @WalkerBoh, now i try to set iframe's width and height, but the result is same – LarAng Nov 14 '17 at 19:45
  • Remove the img tag and set the src of your iframe to your image. – Walker Boh Nov 14 '17 at 19:47
  • @WalkerBoh, Thanks for your response. :) Please let me know in detail. Now the tag is non-contents tag, and this is causing problem, without those divs of both cases have no height same. Only when adding into
    , those height is different, so I want to know why
    has no height and how to fix as
    with has height though in
    – LarAng Nov 14 '17 at 19:55
  • Maybe for this problem I can give 'min-height' to div as 20px, but I think this is not correct resolution. Maybe at least the reason should be clarified... So I am asking this question sincerely. – LarAng Nov 14 '17 at 19:59
  • Read this answer: https://stackoverflow.com/questions/5867985/full-screen-iframe-with-a-height-of-100 – Walker Boh Nov 14 '17 at 20:05
  • Thanks @WalkerBoh, I tried those, but not working :(, Now img tag is not for background image, really those div has some other contents as like
    ...
    – LarAng Nov 14 '17 at 20:24

0 Answers0