HTML iframes

The iframe in HTML stands for Inline Frame. The HTML <iframe> tag defines an inline frame, hence it is also called as an Inline frame. It is used to display a nested webpage (a webpage within a webpage).

An HTML iframe embeds another document within the current HTML document in the rectangular region, including scrollbars and borders.

The iframe is basically used to show a webpage inside the current web page.

In this article, you will know HTML Iframes, their implementation through the examples.


<iframe src="URL"></iframe>  

The src attribute is used to specify the URL of the document that occupies the inline frame.


<!DOCTYPE html>
<html lang="en">

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML iframe Example</title>

    <p>Document content goes here...</p>

    <iframe src="" width="555" height="200">
        Sorry your browser does not support inline frames.

    <p>Document content also go here...</p>


The webpage content and iframe contents can interact with each other using JavaScript.

You can set the width and height of iframe by using “width” and “height” attributes.

Each embedded browsing context has its own session history and document.

The browsing context that embeds the others is called the *parent browsing context*.