HTML Frame


By using frames, you can display more than one page in the same browser window.


Iframe Syntax:

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

The URL points to a different web page.


Iframe - Set Height and Width

The height and width attributes are used to define the height and width of the iframe tag.

The attribute is in pixels by default, but you can specify that it is displayed proportionally (for example: "80%").

Example

<iframe loading="lazy" src="demo_iframe.htm" width="200" height="200"></iframe>

 Try It! 


Iframe - Remove the Frame

The frameborder attribute is used to define whether the iframe to display a border.

Set the attribute value to "0" to remove the border of the iframe:

Example

<iframe src="demo_iframe.htm" frameborder="0"></iframe>

Try It! 


Use Iframe to Display a Target Link Page

iframe can display a target link page

The attributes of the target link must use the attributes of the iframe, as in the following example:

Example

<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="http://www.tutorialfish.com" target="iframe_a" rel="noopener">TUTORIALFISH.COM</a></p>

 Try It! 


HTML iframe Tag

LabelDescription
<iframe>            Define an inline iframe