Skip to main content

html-tags.com

<iframe>

A nested browsing context — another document embedded in this one.

Baseline: Widely available · Media & embedded content

When to use it

For embeds you can't inline (maps, videos, sandboxed widgets); always with title for assistive tech and loading='lazy' below the fold.

When not to

Every iframe costs a document fetch and layout — use sparingly, and sandbox untrusted content.

Key attributes

src / srcdoc
the embedded document
title
accessible name (required in practice)
loading
lazy
sandbox / allow
capability restrictions
width / height

Example

<iframe title='A minimal embedded document' srcdoc='&lt;p&gt;Hello from inside.&lt;/p&gt;' width='320' height='80' loading='lazy'></iframe>
Rendered live above, source below.

Authoritative references