HTML Iframes

Learn to embed external content like videos and maps with the <iframe> tag.

Iframes in HTML

Iframes are like windows to other web pages, allowing you to embed external content directly into your site.

The <iframe> Element

The <iframe> tag defines an inline frame, used to embed another document within the current HTML document. It's a powerful tool for integrating third-party content.

Key Attributes: src, width, height

The most important attribute is src, which specifies the URL of the page to embed. The width and height attributes control the dimensions of the iframe.

Purpose and Use Cases

Iframes are commonly used to embed content like YouTube videos, Google Maps, social media feeds, or even entire websites, providing rich interactivity without leaving the page.

Practice Zone


Interactive Test 1: Drag & Drop

Arrastra en el orden correspondiente.


Arrastra las opciones:

width="560" height="315"
allowfullscreen

Completa el código:

<iframe ______ src='https://www.youtube.com/embed/video_id'></iframe>
width='560' height='315' ______

Interactive Test 2: Fill in the Blanks

Rellena los huecos en cada casilla.

< width="560" height="315" src="..." ></>

Practice Example: Code Editor

Embed a YouTube video using the <iframe> tag. Ensure it allows fullscreen mode and has a defined width and height.

* Write the code below. Correct characters will be shown in green and incorrect ones in red.

<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>

Knowledge Check

Which attribute allows an iframe's content to be displayed in fullscreen mode?