HTML Iframes

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