HTML <iframe> tag
With HTML (hypertext markup language), the <iframe> tag is a block element used to designate an inline frame, which allows the user to embed an HTML document into the current web page. It is useful when you want to add interactive content, advertisements, or content that utilizes a scrollbar. The following sections contain information about this tag, including an example of it in use, and related attributes and browser compatibility.
Example of <iframe> code
<iframe src="https://www.computerhope.com/" height="250px" width="100%"> </iframe>
Example result
Attributes
All HTML tags support standard attributes that define the settings of an HTML element. In addition to the standard settings, the <iframe> tag has the following unique attributes.
Attribute | Description |
---|---|
height | Designates the height of the <iframe> |
name | Designates a name for the <iframe> |
sandbox | Designates extra restrictions used on the content in the <iframe> |
seamless | Designates that the <iframe> should appear as part of the page |
src | Designates the URL (uniform resource locator) of the document to be embedded. |
width | Designates the width of the <iframe> |
Deprecated attributes
In addition to the above attributes, the <iframe> tag had the following deprecated attributes.
Attribute | Description |
---|---|
align | Designates the alignment of the <iframe> with respect to the content around it. |
frameborder | Toggles borders for the <iframe>. |
longdesc | Designates additional information about the content. |
marginheight | Designates the bottom and top margins for an <iframe>. |
marginwidth | Designates the right and left margins for an <iframe>. |
scrolling | Toggles scrollbars for the <iframe>. |
Compatibility
Edge | Internet Explorer | Firefox | Safari | Opera | Chrome |
---|---|---|---|---|---|
All versions | All versions | All versions | All version | All versions | All versions |
Browser, Compatibility, Container tag, Scroll bar, Web design terms, Web page