IFrames and Embedding Content
What is an IFrame?
An <iframe> (inline frame) is used to embed another webpage or external
content inside your HTML page.
Basic Syntax
<iframe src="[Link] width="600" height="400"></iframe>
• src specifies the URL of the page to embed.
• width and height set the size of the frame.
Example: Embed a Website
<iframe src="[Link] width="800" height="500"></iframe>
Example: Embed a YouTube Video
YouTube provides embed code for each video.
<iframe width="560" height="315"
src="[Link]
frameborder="0"
allowfullscreen>
</iframe>
Attributes
Attribute Description
src URL of the page or content
width , height Size of the iframe
frameborder Border of the frame (0 = none)
allowfullscreen Allows video to go full screen
loading="lazy" Delays loading until iframe is visible
Security Note
Some websites may block iframe embedding for security reasons using headers
like X-Frame-Options .
Tip
• Use <iframe> to embed maps, videos, forms, and external tools.
• Always set appropriate width and height for better layout control.