How are iframes used in html?

拈花ヽ惹草 提交于 2019-12-12 08:04:21

问题


What is an iframe, and how is it used in html?


回答1:


An iframe is an object that allows you to embed external content in your HTML page. You can use it to display other web pages, documents (e.g. PDF) etc (although for complex media types you may want to try the object tag instead).

You can add an iframe to your page like so:

<iframe src ="externalContent.html" width="400" height="300">
  <p>Your browser does not support iframes.</p>
</iframe>

The p tag inside will display if iframes are not supported by the browser being used.




回答2:


The iframe element denotes an inline frame, simple as that.

Example usage:

<iframe src="foo.html">
 <p>Your browser does not support <code>iframe</code> elements.</p>
</iframe>



回答3:


Example of iframe - https://jsfiddle.net/vsaurabhaec/jsgbncf0/

Example with url :

<iframe src="https://www.findertoday.com/address-finder/address/Bhagatpur+Tea+Garden-9953?width=500&access_method=findertoday" target="_parent" width="500" height="270" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>

Example with content :

<iframe id="FileFrame" src="about:blank">
<html><body>test</body></html>
</iframe>

NB : iframe need some security awareness. css and js does not have control over inner part of iframe and this is advantage of iframe ( some time )



来源:https://stackoverflow.com/questions/2979860/how-are-iframes-used-in-html

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!