iframe {
  border: 1px solid black;
  width: 100%; /* takes precedence over the width set with the HTML width attribute */
}

Each embedded browsing context has its own document and allows URL navigations. The navigations of each embedded browsing context are linearized into the session history of the topmost browsing context. The browsing context that embeds the others is called the parent browsing context. The topmost browsing context — the one with no parent — is usually the browser window, represented by the Window object.

Warning: Because each browsing context is a complete document environment, every

Without this title, they have to navigate into the

Result

Embedding source code in an

Here's how to write escape sequences when using srcdoc:

Result

Technical summary

Content categories Flow content, phrasing content, embedded content, interactive content, palpable content.
Permitted content None.
Tag omission None, both the starting and ending tags are mandatory.
Permitted parents Any element that accepts embedded content.
Implicit ARIA role No corresponding role
Permitted ARIA roles application, document, img, none, presentation
DOM interface HTMLIFrameElement

Specifications

Specification
HTML
# the-iframe-element

Browser compatibility

See also