HTML Iframe
An HTML iframe is an HTML element that allows you to embed another HTML document within the current HTML document. This can be useful for embedding videos, maps, or other external content within a webpage.
The basic syntax for creating an iframe is as follows:
<iframe src="URL" width="width" height="height"></iframe>
The src
attribute specifies the URL of the content to be embedded. The width
and height
attributes specify the size of the iframe in pixels.
Here’s an example of an iframe that embeds a Google Map:
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3861.455478616199!2d-96.79743918490968!3d32.780575880966556!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x1b9d1b73846479b9!2sAT%26T%20Stadium!5e0!3m2!1sen!2sus!4v1649112392719!5m2!1sen!2sus" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
This iframe embeds a Google Map that displays the location of AT&T Stadium in Arlington, Texas. The src
attribute specifies the URL of the embedded map, and the width
and height
attributes set the dimensions of the iframe.
You can also add other attributes to the iframe tag, such as allowfullscreen
to allow the content to be viewed in fullscreen mode, or scrolling
to control whether or not the iframe has scrollbars.
Keep in mind that if you’re embedding content from an external source, you should make sure that you have the legal right to do so and that you’re not violating any copyright laws.