Lesson 22 / 28
iframes
Embedding another page inside yours.
Embedding content
An <iframe> embeds a whole separate document — a map, a video, another site.
<iframe src="https://maps.example.com" width="400" height="300" title="Location map"></iframe>The sandbox attribute
sandbox restricts what an embedded page can do (scripts, forms, popups) — use it for untrusted content.
Quick check: What is a common real-world use of an iframe?
- Embedding a YouTube video or map
- Styling text
- Validating a form
Answer
Embedding a YouTube video or map — iframes commonly embed third-party widgets like videos, maps and payment forms.