An iframe in HTML is used to embed another webpage or external content inside your current webpage. It allows you to display content from different sources within a single page.
What is an iFrame
The iframe stands for inline frame. It creates a frame within your webpage that can load another HTML page, website, video, or map.
iframe Tag
The <iframe> tag is used to embed external content.
Basic Example
<iframe src=”https://example.com”></iframe>
This will display the content of the given website inside your page.
Common Uses of iFrames
Embedding YouTube videos
Displaying Google Maps
Showing external websites or tools
Important Attributes
src defines the URL of the page to display.
width and height control the size of the frame.
allowfullscreen allows full screen mode for videos.
loading=”lazy” improves performance by loading content when needed.
Example with Attributes
<iframe src=”https://example.com” width=”600″ height=”400″></iframe>
Advantages of iFrames
They allow easy integration of external content.
They save time because you do not need to build everything from scratch.
Limitations of iFrames
Some websites block iframe embedding for security reasons.
Too many iframes can slow down your website.
Summary
iFrames are used to embed external content inside a webpage. They are useful for adding videos, maps, and other resources easily.