HTML <iframe> tag
When writing in HTML, 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, as well as related attributes and browser compatibility.
Example of <iframe> code
<iframe src="https://www.computerhope.com/" height="250px" width="100%"> </iframe>
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The following table shows all of the current unique HTML attributes for the <iframe> tag, as well as a description of each.
|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 of the document to be embedded.|
|width||Designates the width of the <iframe>|
A deprecated attribute is one that may function currently but is not supported in going forward. While the attribute may work with the current version of HTML, it will eventually be phased out. It is better to avoid using these attributes to help future-proof your website.
|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>.|
|All versions||All versions||All versions||All version||All versions||All versions|