HTML <iframe> Element
The <iframe> tag in HTML is used to embed another web page within the current web page. This allows you to display content from another website directly on your own site. The <iframe> tag is often used to display maps, videos, or other external content.
To use the <iframe> tag, you simply need to provide the URL of the page you want to display within the src attribute. You can also specify the width and height of the <iframe>, as well as other attributes to customize its appearance and behavior.
Main <iframe> tag attributes:
| Attribute | Description |
|---|---|
| src | The URL of the page to be embedded in the <iframe>. |
| width | The width of the <iframe> in pixels or percentage. |
| height | The height of the <iframe> in pixels. |
| frameborder | Specifies whether or not to display a border around the <iframe>. |
| scrolling | Specifies whether or not to display scrollbars within the <iframe>. |
Here is an example of how to use the <iframe> tag:
<iframe src="https://www.example.com" width="800" height="600" frameborder="0" scrolling="no"></iframe>
In this example, we are embedding the page "https://www.example.com" within an iframe with a width of 800 pixels, a height of 600 pixels, no border, and no scrolling.