An HTML iframe embeds another HTML document within the current HTML page. It allows you to embed another web page, video, or other media type 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 frame.
You can also specify additional attributes such as “frameborder” (to add or remove a border around the iframe), “scrolling” (to turn on or off 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 frame border is set to “0” to remove the border, scrolling is set to “no” to turn off 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 maliciously, so using them only from trusted sources is essential.