Example

A simple <iframe> tag:

Laboratory

description & Usage

The <iframe> tag stands for inline frame and is used to display other web pages within an HTML document.

Notes

Note: You can also use the <embed> tag to display other HTML pages, but it is recommended to use the <iframe> tag.

Browser compatibility and Support

# Chrome Edge Firefox Safari Opera
<iframe>

Attributes

Attributes Values Description
height
pixels
Determines the height of the corresponding tags on the right.
name
text
Specifies the name of the tag.
sandbox
allow-forms allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation
Specifies a set of additional constraints for the content inside the <iframe> tag.
src
URL
Specifies the source or URL of the audio and video media.
srcdoc
HTML-code
Specifies the content corresponding to the <iframe> tag in HTML documents.
width
pixels
Determines the width of the corresponding elements on the right.

Global Attributes

The <iframe> tag supports the HTML Global Attributes.

Event Attributes

The <iframe> tag supports the HTML Event Attributes.

Default CSS

Most browsers will display the <iframe> tag with the following default style: