开发者

Using an iframe in a DIV kills rest of page

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 w开发者_运维知识库ith 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


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!


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜