Published Jul 1, 2022
Contribute to Docs

The <iframe> element represents a container used to embed a second web page inside the current one. It can be used for content from the same domain as the parent, or even from a second domain.



<iframe> is an element that uses attributes to define important properties. It should not contain any elements between the opening and closing tags. Common attributes are:

  • src, which specifies the URL to embed
  • height, which specifies the height of the <iframe> and defaults to 150 pixels
  • width, which specifies the width of the <iframe> and defaults to 300 pixels

Additional attributes set security policies (using csp or referrerpolicy attributes), or enable features for the iframe (using allow or sandbox attributes)


<head> </head>
<h1>This text is from the current webpage</h1>
<!-- This will add https://www.codecademy.com/learn to the current page in an embedded frame -->

This will render the following output:

Rendered <iframe> tag example

All contributors

Looking to contribute?

Learn HTML on Codecademy