html tutorial - <iframe> Tag in HTML - html5 - html code - html form



iframe tag in html

Learn html - html tutorial - iframe tag in html - html examples - html programs

  • An <iframe> tag used to embed another page or document into the current HTML page.
  • We can use multiple Inline Frame in a single HTML page.
  • Each Inline Frame has its own session history and active documents.
  • <iframe> tag belongs to Flow content, phrasing content, embedded content, interactive content and palpable content.
  • <iframe> tag supports Global Attributes and Event Attributes.

Syntax for <iframe> tag:

<iframe src="URL"></iframe>

Sample Coding for <iframe> tag:

Tryit<!DOCTYPE html>
<html >
    <head>
        <title>Wikitechy iframe tag</title>
    </head>
    <body>
        <iframe src=”http://www.wikitechy.com/”>
            <p>Browser not Supported.</p>
        </iframe>
    </body>
</html>

Code Explanation for <iframe> tag:

<iframe> Tag Code Explanation

  1. <iframe> tag used to embed “http://www.wikitechy.com/” in the current HTML Page.

Output for <iframe> tag:

<iframe> Tag Output

  1. The output shows the ”http://www.wikitechy.com/” in the inline frame.

Attributes of <iframe> tag:

Attribute Value HTML4 HTML5 Description
align left
right
top
middle
bottom
Yes No Specifies the alignment of an <iframe> according to surrounding elements.
frameborder 1
0
Yes No Specifies whether or not to display a border around an <iframe>.
height pixels Yes Yes Specifies the height of an <iframe>.
longdesc URL Yes No Specifies a page that contains a long description of the content of an <iframe>.
marginheight pixels Yes No Specifies the top and bottom margins of the content of an <iframe>.
marginwidth pixels Yes No Specifies the left and right margins of the content of an <iframe>.
sandbox allow-forms
allow-pointer-lock
allow-popups
allow-same-origin
allow-scripts
allow-top-navigation
No Yes Enables an extra set of restrictions for the content in an <iframe>
name text Yes Yes Specifies the name of an <iframe>
scrolling yes
no
auto
Yes No Specifies whether or not to display scrollbars in an <iframe>
src URL Yes Yes Specifies the address of the document to embed in the <iframe>
srcdoc HTML_code No Yes Specifies the HTML content of the page to show in the <iframe>
width pixels Yes Yes Specifies the width of an <iframe>

Browser Support for <iframe> tag in HTML:

Yes Yes Yes Yes Yes

Related Searches to iframe tag in html