What are HTML Iframes?

An iframe is an HTML document embedded inside another HTML document. The <iframe> tag specifies the URL of the embedded content, allowing for seamless integration of external resources. This section will guide you through the syntax and attributes of the <iframe> tag, providing a solid foundation for your iframe usage.

Syntax:

<iframe src="URL" title="description"></iframe>
  • The src attribute specifies the URL of the document you want to embed.
  • Iframes can include videos, maps, or entire web pages from other sources.

Attributes Value:

It contains a single value URL that specifies the URL of the document that is embedded in the iframe. There are two types of URL links which are listed below:

URL

Descriptions

Absolute URL

It points to another webpage.

Relative URL

It points to other files of the same web page.

Supported Attributes:

AttributesDescription
allowSpecifies a set of extra restrictions on the content that can be loaded in an <iframe>.
allowfullscreenIndicates whether the <iframe> can be displayed in fullscreen mode.
allowpaymentrequestEnables payment requests for content inside the <iframe>.
heightSets the height of the <iframe> element.
widthSets the width of the <iframe> element.
loadingSpecifies how the content of the <iframe> should be loaded.
scrollingControls whether or not the <iframe> should have scrollbars.
name Specifies the name of the <iframe> for targeting its content or for referencing it in JavaScript.
referrerpolicySets the referrer policy for the <iframe> content.
sandboxSpecifies an extra set of restrictions for the content in the <iframe>.
srcSpecifies the URL of the document to embed in the <iframe>.
srcdocSpecifies the HTML content of the page to display in the <iframe>.

HTML Iframes

HTML iframes offer a powerful way to embed external content, such as videos, maps, or other webpages, directly into your own webpage. This article provides an in-depth exploration of HTML iframes, their syntax, and how they can be used to enhance your web development projects.

Similar Reads

What are HTML Iframes?

An iframe is an HTML document embedded inside another HTML document. The