
An HTML iframe is used to embed another HTML document within the current HTML page. It allows you to embed another web page, video, or any other type of media within the current page.
Here’s an example of how to use an HTML iframe:
<iframe src="https://www.example.com" width="600" height="400"></iframe>
The “src” attribute specifies the source URL of the document to be embedded, while the “width” and “height” attributes define the size of the iframe.
You can also specify additional attributes such as “frameborder” (to add or remove a border around the iframe), “scrolling” (to enable or disable scrolling within the iframe), and “name” (to give the iframe a name).
Here’s an example that demonstrates some of these additional attributes:
<iframe src="https://www.example.com" width="600" height="400" frameborder="0" scrolling="no" name="myiframe"></iframe>
In this example, the frameborder is set to “0” to remove the border, scrolling is set to “no” to disable scrolling within the iframe, and a name is given to the iframe to allow it to be referred to from other parts of the page.
It’s important to note that iframes can also be used for malicious purposes, so it’s important to only use them from trusted sources.