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>:
-
src
Specifies the URL of the content to embed.
Example: <iframe src="https://example.com"></iframe> -
width
Defines the width of the iframe in pixels or percentage.
Example: <iframe "> -
height
Defines the height of the iframe.
Example: <iframe height="400"> -
title
Provides a text description for accessibility.
Example: <iframe title="Embedded page"> -
allowfullscreen
Allows fullscreen mode for video or other media if supported.
Example: <iframe allowfullscreen> -
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.