The <iframe>
tag in HTML is used to embed another web page or document within the current page. <iframe>
allows for the insertion of content from external sources, such as videos, maps, or other websites.
Examples of using <iframe>
:
- Embedding a YouTube video:
<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
- Embedding a Google Map:
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3151.8354345093765!2d144.9537363153218!3d-37.81627977975171!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x6ad642af0f11fd81%3A0xf5778a4f2bdee60!2sGoogle!5e0!3m2!1sen!2sus!4v1456149492751" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>
The <iframe>
tag is useful for integrating external content without having to host it directly on your server, which can save resources and simplify content management.