Web4College

HTML iframe tag

HTML <iframe> tag is an inline frame. It provides frame in a page to browse the content. Content may be a page, image or another website.

Example
Try it
<iframe src="files/value.html" height="500px" width="500px">
</iframe>

Tag Uses

Specific uses of <iframe> tag

iframe is usually used to browse the content inside a frame.

Tag omission

Both starting and ending tags are necessary for the iframe element.

Global Attributes

All global attributes are applicable on the iframe element.

Tag Attributes

Attributes that are applicable to <iframe> tag
src

It represents the location of the resource.

Example
Try it
<iframe src="Address of external resource" ></iframe>
name

It defines a name for the frame so that hyperlink may be browsed in this frame.

Example
Try it
<iframe src="Location of external resource" name="unique name"></iframe>
sandbox

It specifies security rules for the content inside frame.

Example
Try it
<iframe src="URL" sandbox></iframe>
width

It defines the horizontal dimension of iframe.

Example
Try it
<iframe src="URL" width="500"></iframe>
height

It defines the vertical dimension of iframe.

Example
Try it
<iframe src="URL" height="700"></iframe>