Media & Embedded Content
HTML <iframe> Tag
The <iframe> tag specifies an inline frame.
Definition and Usage
The <iframe> tag specifies an inline frame.
Standard Syntax:
<iframe>...</iframe>Interactive ExampleRunnable
HTML <iframe> Example
htmlLive code demonstration for the <iframe> tag. Click "Try it Yourself" to edit and experiment in real time.
<div style="font-family: system-ui, sans-serif; padding: 16px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; color: #0f172a;">
<iframe src="https://ea-academy.com" title="EA Academy Free
Online Web Tutorials"></iframe>
</div>Attributes for <iframe>
10 Supported Attributes| Attribute | Values | Default | Description |
|---|---|---|---|
| allow | string | none | Specifies a feature policy for the <iframe> |
| allowfullscreen | truefalse | none | Set to true if the <iframe> can activate fullscreen mode by calling the requestFullscreen() method |
| height | pixels | none | Specifies the height of an <iframe>. Default height is 150 pixels |
| loading | eagerlazy | none | Specifies whether a browser should load an iframe immediately or to defer loading of iframes until some conditions are met |
| name | text | none | Specifies the name of an <iframe> |
| referrerpolicy | no-referrerno-referrer-when-downgradeorigin origin-when-cross-originsame-originstrict-origin-when-cross-originunsafe-url | none | Specifies which referrer information to send when fetching the iframe |
| sandbox | allow-formsallow-pointer-lockallow-popups allow-same-origin allow-scripts allow-top-navigation | none | Enables an extra set of restrictions for the content in an <iframe> |
| src | URL | none | Specifies the address of the document to embed in the <iframe> |
| srcdoc | HTML_code | none | Specifies the HTML content of the page to show in the <iframe> |
| width | pixels | none | Specifies the width of an <iframe>. Default width is 300 pixels |
Global Attributes
The <iframe> tag also supports the standard global attributes in HTML, including class, id, style, title, hidden, and data-*.
Event Attributes
The <iframe> tag supports event attributes in HTML, such as onclick, onmouseover, onfocus, and more.
Browser Compatibility
ChromeEdgeFirefoxSafariOpera
More Tags in Media & Embedded Content
View All 123Tags →<applet>Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.<area>The <area> tag defines an area inside an image map (an image map is an image with clickable areas).<audio>The <audio> tag is used to embed sound content in a document, such as music or other audio streams.<canvas>The <canvas> tag is used to draw graphics, on the fly, via scripting (usually JavaScript).<embed>The <embed> tag defines a container for an external resource, such as a web page, a picture, a media player, or a plug-in application.<img>The <img> tag is used to embed an image in an HTML page.