VOOZH about

URL: https://www.geeksforgeeks.org/html/html-iframe-srcdoc-attribute/

⇱ HTML | <iframe> srcdoc Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML | <iframe> srcdoc Attribute

Last Updated : 27 May, 2026

The HTML <iframe> srcdoc attribute is used to embed HTML content directly inside an iframe instead of loading it from an external URL.

  • Specifies inline HTML content for the iframe.
  • Can be used with sandbox for added security.
  • Overrides the src attribute when both are present.

Syntax: 

<iframe srcdoc="HTML_code">

Attribute Values 

  • HTML_code: It is used to specify the HTML content of the page which will display in an iframe element.
Comment
Article Tags: