Advertisement
Home Open Editor ❯

HTML srcdoc Attribute

Example

<iframe srcdoc="<h1>Hello world!</h1><p>Hello world!</p>" src="demo/demo.html">
  Your browser does not support iframe element.
</iframe>

Try this code ❯

Meaning

Inline HTML to embed, overriding the src attribute. If a browser does not support the srcdoc attribute, it will fall back to the URL in the src attribute.


Standard Syntax

<element srcdoc="HTMLCode">


Applies to:

The srcdoc attribute can be used on the following element:

Element Attribute
<iframe> srcdoc

Advertisement

Attribute Values

Value Description
HTMLCode The HTML content to show in the iframe.
Home Open Editor ❯
Advertisement