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.

Syntax

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

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

Example

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

<head>
    <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>
</head>

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

    <iframe src="https://eywiah.com/" width="555" height="200">
        Sorry your browser does not support inline frames.
    </iframe>

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

</html>

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*.