HTML Iframes

Embed another web page inside your page.

✍️ 3 exercises + code challenge in this lesson

An <iframe> displays another web page inside the current one. It is commonly used for maps, videos and widgets.

  • src: the URL to show.
  • width / height: the frame size.
  • title: a description for screen readers.
Some sites block being shown in an iframe for security reasons. YouTube and Google Maps provide special "embed" URLs for this purpose.

Key Takeaways: HTML Iframes

Mastering HTML Iframes helps you write clean and reliable HTML code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

HTML Iframes Code Example

HTML
<h3>An embedded map</h3>
<iframe
  src="https://www.openstreetmap.org/export/embed.html?bbox=73.0,33.65,73.15,33.75&layer=mapnik"
  width="400" height="250" style="border: 1px solid #CBD5E1;"
  title="Map of Islamabad"></iframe>
Free sign-in required · Google login available

HTML Iframes Practice Exercises

Check what you learned in “HTML Iframes”.

/ 3 solved
Fill in the blank

Embed another page.

< src="https://example.com" width="400" height="300"></>
✓ Correct! Not quite. Try again.
Multiple choice

What does an <iframe> do?

✓ Correct! Not quite. Try again.
Code challenge

Add an iframe with the title "Map" that is 300 pixels wide.

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services