iframe tag

<iframe>

Explanation

Iframe tag inserts an "Inline Frame" in a HTML document.
The inline frames helps to fix a source in a HTML document.
<iframe src="URL"></iframe>
Element Specific attributes supported by this tag are:
AttributeValueDescription
name name Mentions the name of iframe.
height pixels Denotes the height level of iframe.
width pixels Denotes the width level of iframe.
src url The address/URL of the content to be fixed in iframe.
sandbox "", allow-forms, allow-same-origin, allow-scripts, allow-top-navigation Creates limitations for iframe contents.
seamless seamless Defines that iframe should look like the part of the containg document.
srcdoc HTML_code The HTML content of a page to be shown in iframe.

"Height, Sandbox, Seamless and SRC" attributes were newly introduced in HTML5.

Example Code:

Result :
  • Use "Height and Width" attributes to maximize and minimize the size of the iframe.
  • User can use this tag to promote the site by displaying "Ads".
  • If required, the CSS can be used to add "Scrollbars" for iframe.
It is available in previous versions of HTML.
It supports both Global Attributes and Event Attributes in HTML5.

Limitations:

It is applicable to all major browsers.

Ask Questions

Ask Question