iframe
Embeds another browsing context, often another page or widget.
Learn iframe, embed, object as part of the HTML element system: when to use it, how it fits inside a document and what mistakes to avoid.
Embedded
iframe, embed and object can display content that is not part of the current document flow in the normal way.
Embedding is powerful, but it has security, performance and accessibility tradeoffs. Never treat an embed as harmless just because it appears inside your page.
iframe, embed, object. External or isolated content that needs security thinking. Syntax in context
A production iframe should have a useful title and the smallest permission set possible.
<iframe src="lesson-demo.html" title="Interactive HTML lesson demo" loading="lazy" sandbox="allow-scripts"> </iframe>
Good versus weak
<iframe src="lesson-demo.html" title="Interactive HTML lesson demo" loading="lazy" sandbox="allow-scripts"> </iframe>
<iframe src="https://example.com"></iframe>
Rules that matter
The title explains the embedded content to assistive technology.
Use sandbox and allow only what is needed.
Embeds can load scripts, trackers, media and heavy layouts.
Do not embed content that could simply be part of the page.
Production thinking
Beginners often ask why this is not just a div with styling. The reason is that HTML is read by browsers, search engines, screen readers and future developers. Clear meaning makes the page easier to use and maintain.
Without a title, iframe content is hard to identify for screen reader users.
Embeds are a security boundary decision. Use sandbox, lazy loading and clear vendor trust rules.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.