HTML Iframes

Article Summary

Learn how to embed content using HTML iframes with common attributes and best practices.

An iframe is used to embed another webpage inside the current page.


Basic Iframe Example

<iframe 
  src="https://example.com"
  title="Example iframe"
  width="600"
  height="400"
  loading="lazy">
</iframe>

Attributes Used

  • src → embedded page URL
  • title → accessibility text
  • width / height → size
  • loading → load behavior

Iframe with Restrictions

<iframe 
  src="page.html"
  sandbox
  referrerpolicy="no-referrer">
</iframe>

Important Notes

  • Always include title
  • Use iframes only when needed
  • Some sites block iframe embedding
Was this helpful?