HTML <iframe> tag

You are Here:

HTML <iframe> tag

The <iframe> tag is used to embed another document into the current HTML document.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <iframe src="/js"> <p>Your browser does not support iframes.</p> </iframe> </body> </html>

Attributes

The following are the attributes of <iframe> tag. Also try Global attributes.

AttributeValueExplanation
heightpxSpecifies the height of an <iframe>.
nametextSpecifies the name of an <iframe>.
referrerpolicy
  • no-referrer
  • no-referrer-when-downgrade
  • origin
  • origin-when-cross-origin
  • unsafe-url
Specifies whether or not to sent http referrer information.
sandbox
  • allow-forms
  • allow-pointer-lock
  • allow-popups
  • allow-same-origin
  • allow-scripts
  • allow-top-navigation
Enables an extra set of restrictions for the content in an <iframe>.
srcURLSpecifies the location (URL) of the document to be displayed inside an <iframe>.
srcdocHTML_codeSpecifies the inline HTML to embed in the <iframe>.
widthpxSpecifies the width of an <iframe>.

Deprecated Attributes

The following attributes should not be used in any case.

AttributeValueExplanation
align
  • left
  • right
  • top
  • middle
  • bottom
Specifies the alignment of the <iframe> concerning the surrounding context.
frameborder1 or 0Specifies whether or not to draw a border around an <iframe>.
longdescURLSpecifies a document which contains a long description of the content of an <iframe>.
marginheightpxSpecifies the amount of space between the <iframe> content and its top and bottom borders.
marginwidthpxSpecifies the amount of space between the <iframe> content and its left and right borders.
scrolling
  • auto
  • yes
  • no
Specifies when the browser should provide a scroll bar to the <iframe> content.

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author