Tutorial :Using an iframe in a DIV kills rest of page



Question:

If I put a simple iframe within a DIV any DIV's below it do not show up, the page stops there. If I just type some text with no iframe, it works fineâ€"so it is the adding of the iframe that causes it.

The file loaded by the iframe is dummied right down and just displays the word TEST.

Before I start posting a lot of code and stuff, is this generally an issueâ€"can an iframe be used within a DIV statement?

Thanks


Solution:1

Sounds like you're making a pretty common coding error: you can't short-tag an iframe. For instance:

<iframe src=" ... " />  

is invalid. You must provide a full closing element:

<iframe src=" ... "></iframe>  

It's silly, but it can cause your page to completely gum up. Also, check to make sure your quotes/apostrophes/carets are all proper, as those can cause similar problems.

Hope this helps!


Solution:2

There's no reason you can't wrap an Iframe in a DIV, but Iframes are notoriously difficult in layout and obviously we don't know what other styling rules might be affecting your box model.

You might try giving the containing DIV an 'overflow:scroll' or even just 'overflow:auto' in your CSS. This can help fix strange box model issues.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »