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 - Setting Height and Width
The height and width attributes are used to define the height and width of the iframe tag.
The attributes default to pixels, but you can specify them to be displayed proportionally (e.g., "80%").
Example
<iframe loading="lazy" src="demo_iframe.htm" width="200" height="200"></iframe>
iframe - Removing the Border
The frameborder attribute is used to define whether the iframe should display a border.
Setting the attribute value to "0" removes the iframe's border:
Example
Using iframe to Display a Target Link Page
An iframe can display a target link page.
The target link's attribute must use the iframe's attribute, as shown in the following example:
Example
<iframe src="demo_iframe.htm" name="iframe_a"></iframe>
<p><a href="https://www.tutorialpro.org" target="iframe_a" rel="noopener">tutorialpro.org</a></p>
HTML iframe Tag
Tag | Description |
---|---|
<iframe> | Defines an inline frame |