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.

<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.

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

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

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

It specifies security rules for the content inside frame.

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

It defines the horizontal dimension of iframe.

<iframe src="URL" width="500"></iframe>
height

It defines the vertical dimension of iframe.

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


Was this article helpful?