iframes

What is an iframe?

The <iframe> element is used to embed another document within the current HTML document. It creates a nested browsing context, allowing you to display content from another source, such as another webpage or multimedia content.

How to Use iframe

You can define an iframe in your HTML using the <iframe> tag. Here’s a basic example:

<iframe src="https://www.example.com"></iframe>

The src attribute specifies the URL of the page to embed.

Examples of iframe

Example 1: Basic iframe

Here is a simple iframe that loads a webpage:

Example 2: iframe with Additional Attributes

This iframe includes width, height, and border attributes:

Example 3: Responsive iframe

This iframe is styled to be responsive: