Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an iframe in a DIV kills rest of page

Tags:

html

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

like image 746
Beauford Avatar asked Jul 22 '10 00:07

Beauford


People also ask

Is it possible to use iframe in div segment?

In order to make your embedded iframe responsive, you need to wrap the iframe in a div and apply inline css. Follow these simple steps: Get the iframe embed code and paste in into your HTML page. Set the height and the width attributes of the iframe tag to 100%

Can you iframe a specific part of page?

Set the iframe to the appropriate width and height and set the scrolling attribute to "no". If the area you want is not in the top-left portion of the page, you can scroll the content to the appropriate area.

Why is iframe deprecated?

IFrames are not obsolete, but the reasons for using them are rare. Using IFrames to serve your own content creates a "wall" around accessing the content in that area. For crawlers like Google, It's not immediately clear that cotent in an iframe will be ranked as highly as if the content were simply part of the page.

What can I use instead of iframe?

Use the object Tag as an Alternative to Iframe in HTML We can use the tag to display another webpage in our webpage. The object tag is an alternative to the iframe tag in HTML. We can use the tag to embed different multimedia components like image, video, audio, etc.


1 Answers

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!

like image 168
mattbasta Avatar answered Sep 21 '22 17:09

mattbasta