<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
referrerpolicy attributes), or enable features for the iframe (using
<html><head> </head><body><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 --><iframeheight="300"width="300"src="https://www.codecademy.com/learn"></iframe></body></html>
This will render the following output:
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.
Learn HTML on Codecademy
Front-End EngineerFront-end engineers work closely with designers to make websites beautiful, functional, and fast.
Includes 34 Courses
With Professional Certification