HTML Dog
Skip to navigation

HTML Tag: iframe

An inline frame, or nested browsing context — essentially, a web page embedded within a web page.

Optional Attributes

Attribute Description Possible values
src The address of the web page to embed. URL.
name A unique name for the frame. Text.
sandbox Applies security rules, restricting the content of the embedded page. None. Alternatively, lifting individual restrictions can be done with a value consisting of a single instance, or space-separated list, of:
  • allow-forms
  • allow-pointer-lock
  • allow-popups
  • allow-same-origin
  • allow-scripts
  • allow-top-navigation
srcdoc Directly applies content to the embedded page. Overrides src. HTML.
width The pixel-width of the frame. Number.
height The pixel-height of the frame. Number.
Global attributes

Example


<iframe src="http://www.htmldog.com/references/html/tags/iframe" name="htmlDogIframe"></iframe>

<!-- or, securely, applying restrictions... -->

<iframe sandbox src="http://www.htmldog.com/references/html/tags/iframe"></iframe>

<!-- or, just allowing forms and scripts... -->

<iframe sandbox="allow-forms allow-scripts" src="http://www.htmldog.com/references/html/tags/iframe"></iframe>

<!-- or, applying something a little bit different... -->

<iframe srcdoc="<p>Clunky, not funky, fool.</p>" src="http://www.htmldog.com/references/html/tags/iframe"></iframe>