CSS Portal

HTML <iframe> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <iframe> tag in HTML stands for inline frame. It is used to embed another HTML document within the current document, essentially creating a window or frame that displays external content. Unlike links, which navigate the user to a different page, an <iframe> allows content from another source to appear directly on the page without leaving the current context.

This makes <iframe> useful for a wide range of scenarios, such as embedding videos, maps, advertisements, interactive widgets, or even entire websites. The embedded content operates independently from the parent document, meaning it has its own browsing context and can have its own HTML structure, styles, and scripts.

One key characteristic of <iframe> is that they are self-contained. The content inside the frame does not automatically inherit the styles or scripts of the parent page, although it can communicate with the parent document using JavaScript if allowed by security policies. This separation is crucial for security, especially when embedding content from third-party sources.

Additionally, <iframe> can vary in size and appearance. By default, they display a rectangular window within the page, but designers can adjust the height, width, and styling to integrate the frame seamlessly into the layout. Despite their flexibility, <iframe> should be used thoughtfully because excessive use can affect page performance, load times, and accessibility if not properly handled.

Properties

Permitted Parents
Any element that accepts embedded content
Content
Any block, inline and text
Start/End Tags
Start tag: required, End tag: required

Example

<iframe id="I1" name="I1" src="images/sunset.jpg">Your 
browser does not support inline frames or is currently
configured not to display inline frames.</iframe>

Attributes

name
Assigns a name to a frame. This is useful for loading contents into one frame from another.
width
Specifies the width of the inline frame.
height
Specifies the height of the inline frame.
src
Location of the frame contents (for example, the HTML page to be loaded into the frame).

Global Attributes

The <iframe> tag also supports the Global Attributes in HTML5

Event Attributes

The <iframe> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <iframe> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!