VOOZH about

URL: https://www.geeksforgeeks.org/html/html-iframe-tag/

⇱ HTML <iframe> Tag - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML <iframe> Tag

Last Updated : 23 Jul, 2025

HTML <iframe> Tag facilitates embedding the content from another source such as a video, map, or external website within a webpage. It simply specifies an inline frame.

Syntax

<iframe src=
"https://www.geeksforgeeks.org/"
title="GeeksforGeeks">
</iframe>

Note: It is important to include a title attribute for the <iframe> tag. Screen readers use this attribute to announce the purpose or content of the link.

Attributes

The below table shows the attribute, value, and description of the HTML <iframe> tag.

Attributes

Values

Descriptions

widthpixelsAdjusts the width of the <iframe>. The default is 300 pixels.
srcURLSpecifies the address of the document to embed.
allowfullscreentrue or falseAllows the <iframe> to activate fullscreen mode.
allowpaymentrequesttrue or falseEnables the Payment Request API for cross-origin iframes.
loadingeager or lazyDetermines when the browser should load the <iframe>.
srcdocHTML codeSets the HTML content to display within the <iframe>.
sandboxallow-forms, allow-pointer-lock, allow-popups, allow-same-origin, allow-scripts, allow-top-navigationEnforces restrictions for content within the <iframe>.
allowFeature policy stringSpecifies a feature policy for the <iframe>.
heightpixelsSets the height of the <iframe>. Default is 150 pixels.
nameTextSpecifies a name for the <iframe>.
referrerpolicyno-referrer, no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin-when-cross-origin, unsafe-urlControls referrer information for fetching the iframe.

The <iframe> tag supports the Global Attributes and Event Attributes in HTML.

Example 1: Implementation of the iframe tag by using allowfullscreen attribute for activating fullscreen mode.

Output:

👁 file
iFrane Example ScreenShot


👁 frt

Example 2: Another example illustrating the implementation of iframe tag by using allowfullscreen attribute for activating fullscreen mode and iframe border.

Output:

👁 der

Supported Browsers

  • Chrome 1
  • Edge 12
  • Safari 4
  • Firefox 1
  • Opera 15
Comment
Article Tags:
Article Tags: