HTML Iframes

Embedding Other Pages

An iframe (inline frame) is used to embed another HTML page within the current page.

Iframes are commonly used to embed videos, maps, or content from other websites.

<!-- Basic iframe -->
<iframe src="https://www.example.com" width="600" height="400"></iframe>

<!-- YouTube video embed -->
<iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID" frameborder="0" allowfullscreen></iframe>

<!-- Google Maps embed -->
<iframe src="https://www.google.com/maps/embed?pb=..." width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
  • src - URL of the page to embed
  • width - Width of the iframe
  • height - Height of the iframe
  • frameborder - Border around iframe (deprecated, use CSS)
  • allowfullscreen - Allow fullscreen mode

Try Iframe

<h2>Embedded Content</h2>
<p>Here's an embedded page:</p>
<iframe src="https://www.example.com" width="100%" height="300" style="border: 2px solid #d1039e; border-radius: 8px;"></iframe>

Note: Be cautious with iframes as they can pose security risks. Always use trusted sources.