HTML Tutorial: Introduction of the Iframe Tag

HTML Tutorial: Introduction of the Iframe Tag

In this HTML tutorial, we will discuss the HTML <iframe> tag. Let's see what is the HTML <iframe> tag and how to use the HTML <iframe> Tag.

HTML TUTORIAL

Iframe Tag

An HTML Iframe is a tag that allows you to embed another page or any other content inside a web page. This means you can use it to view content from another website like videos, maps, etc. on the current page.

An Iframe is an HTML tag that displays a document inside a document. It acts like a window or frame through which you can view the content of another page.

Syntax


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>HTML TUTORIAL</title>
    </head>
    <body>
        <iframe width="560" height="315" src="https://www.youtube.com/embed/UR09DXAEYDg?si=-CfdggA9BWJuu5Fk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
    </body>
    </html>

HTML TUTORIAL

About the iframe attribute

SRC:- In this attribute, we are given the link to the web page, the link to the YouTube video, and the link to the Google map. you can see the above example I have added the YouTube video link in the SRC attribute.

Width and Height:- With the help of this attribute we can resize the frame.

frameborder:- With the help of this border we can remove and add the border on the frame. If you give the 0 so border will be removed and if you give the 1 so border will be added.

allowfullscreen:- with the help of the attribute we can see the embedded content on the full screen.

loading:- These options let you decide when the iframe's content is loaded. For example, if you use the "Lazy" option, the iframe's content is not loaded until the tab is visible on the screen. This results in faster page loads, because the iframe's content is loaded later when necessary.

sandbox:- Applies extra restrictions to the content within the iframe, improving security.

Conclusion

If you want to add a video, Google map, or content from any other page to your web page then you can use an HTML iframe tag.

Post a Comment

Previous Post Next Post

Recent in Technology