agyanadda@gmail.com

HTML Iframes

HTML Media 1 min read Updated Nov 30, 2026 Topic 22 of 33

An <iframe> shows another web page inside your page. It is how you embed YouTube videos, Google Maps and forms.

Useful attributes

  • src — the address of the page to show.
  • width / height — the size of the frame.
  • title — describes the content (important for accessibility).
  • loading="lazy" — loads the frame only when the visitor scrolls near it (faster page).
  • allowfullscreen — lets videos go full screen.

Many sites block being shown in iframes for security, so not every page can be embedded.

Examples

Example — Embed a YouTube video HTML
<iframe width="360" height="203"
  src="https://www.youtube.com/embed/qz0aGYrrlhU"
  title="HTML tutorial video"
  loading="lazy"
  allowfullscreen></iframe>

Use the "embed" link from YouTube → Share → Embed.

Try it Now »
Example — Embed a Google Map HTML
<iframe
  src="https://www.google.com/maps?q=Gaya,Bihar&output=embed"
  width="360" height="250" style="border:0;"
  title="Map of Gaya" loading="lazy"></iframe>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which attribute makes an iframe load only when needed?

Exercise 2 True / False

Every website can be embedded in an iframe.

Frequently Asked Questions

The other website does not allow being embedded. Use its official embed link (like YouTube embed) instead.