HTML Iframe

Iframe is used to display web pages within a web page.

Syntax for Adding iframe

<iframe src="URL</iframe>

URL Point to the location of an isolated page.

Iframe - Set Height and Width

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

The default unit of the attribute value is pixels, but it can also be set using percentages (such as "80%").

Example

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

Try It Yourself

Iframe - Remove Border

The frameborder attribute specifies whether to display the border around the iframe.

Setting the attribute value to "0" can remove the border:

Example

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

Try It Yourself

Using iframe as the target of a link

Iframe can be used as the target (target) of a link.

The target attribute of the link must refer to the name attribute of the iframe:

Example

<iframe src="demo_iframe.htm" name="iframe_a"</iframe>
<p><a href="http://www.codew3c.com" target="iframe_a">codew3c.com</a></p>

Try It Yourself

HTML iframe Tag

Tag Description
<iframe> Define inline subwindow (frame)