HTML - HTML <iframe>

The <iframe> tag is used to embed another HTML page or external content within the current web page. It allows you to display things like websites, videos, maps, or documents inside a rectangular frame.

Basic syntax:
<iframe src="URL"></iframe>

Attributes of <iframe>:

  1. src
    Specifies the URL of the content to embed.
    Example: <iframe src="https://example.com"></iframe>

  2. width
    Defines the width of the iframe in pixels or percentage.
    Example: <iframe ">

  3. height
    Defines the height of the iframe.
    Example: <iframe height="400">

  4. title
    Provides a text description for accessibility.
    Example: <iframe title="Embedded page">

  5. allowfullscreen
    Allows fullscreen mode for video or other media if supported.
    Example: <iframe allowfullscreen>

  6. loading
    Specifies when the iframe should load.
    Values are "lazy" or "eager".
    Example: <iframe loading="lazy">

 

Note: Some websites block being displayed in iframes for security reasons.