An iframe
(short for inline frame) is an HTML element that allows you to embed another HTML page within the current page. Iframes are commonly used to embed videos, maps, or other external content.
To create an iframe, use the <iframe>
tag and specify the src
attribute with the URL of the page you want to embed. For example:
<iframe src="https://www.shariqsp.com"></iframe>
You can customize the appearance of an iframe using attributes like width
, height
, and border
. For example:
<iframe src="https://www.shariqsp.com" width="600" height="400" style="border:2px solid #ccc;"></iframe>
To remove the border around an iframe, you can set the frameborder
attribute to "0" or use CSS styling. For example:
<iframe src="https://www.shariqsp.com" frameborder="0" style="border:none;"></iframe>
There are several other useful attributes for iframes:
allowfullscreen
: Allows the iframe to be displayed in full-screen mode.name
: Assigns a name to the iframe for use with JavaScript or form submission targets.sandbox
: Adds extra restrictions to the content inside the iframe for security purposes.loading
: Controls the lazy loading of the iframe (e.g., loading="lazy"
).For example:
<iframe src="https://www.shariqsp.com" allowfullscreen name="myIframe" sandbox="allow-scripts" loading="lazy"></iframe>