The Wayback Machine - https://web.archive.org/web/20240718030024/https://www.geeksforgeeks.org/how-to-set-height-of-an-iframe-element-using-html/
Open In App

How to set height of an iframe element using HTML ?

Last Updated : 26 Nov, 2020
Improve
Suggest changes
Post a comment
Like Article
Like
Save
Share
Report

The iframe in HTML stands for Inline Frame. The “iframe” tag defines a rectangular region within the document in which the browser can display a separate document, including scrollbars and borders. An inline frame is used to embed another document within the current HTML document.

The HTML <iframe> height attribute is used to specify the height of the <iframe> in terms of pixels.

Syntax:

<iframe height="pixels">

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to specify the height of an
        iframe element using HTML?
    </title>
</head>
  
<body style="text-align:center;">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h2>
        How to specify the height of an
        iframe element using HTML?
    </h2>
  
    <iframe src=
            height="100" width="400">
      </iframe>
</body>
  
</html>


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera


Similar Reads

How to load a hyperlink from one iframe to another iframe ?
HTML Iframe or inline frame allows embedment of multiple HTML pages in an HTML page. In this article, we will see how to change the content of one iframe using hyperlinks in another iframe. This can be achieved by the proper usage of the name attribute in the iframe tag and the target attribute in the anchor tag. The name attribute allows each inli
2 min read
How to check if an iframe is present in another iframe in JavaScript ?
In this article, we will see how to check if an iframe is present in another iframe, along with understanding its basic implementation with the help of a simple example. An iFrame is an HTML element that allows users to embed a webpage within another webpage. It's frequently used for displaying content from another website, such as a video or a soc
4 min read
HTML | &lt;iframe&gt; height Attribute
The HTML &lt;iframe&gt; height attribute is used to specify the height of the &lt;iframe&gt; in terms of pixels. Syntax: &lt;iframe height="pixels"&gt; Attribute Values: It contains single value pixel which specifies the height of the iframes in terms of pixels. Below example illustrates the use of &lt;iframe&gt; height attribute in HTML: Example:
1 min read
HTML DOM IFrame height Property
The HTML DOM IFrame height Property is used to sets or return the value of the height attribute of an Iframe Element. The height attribute is used to specify the height of an Iframe Element. Syntax: It returns the height Property. iframeObject.heightIt is used to set the height property. iframeObject.height = pixels Property Values: pixels: It spec
2 min read
How to set full-screen iframe with height 100% in JavaScript ?
Given an HTML document containing an &lt;iframe&gt; element and the task is to change the height of the &lt;iframe&gt; element to 100% with the help of JavaScript. There are two methods to change the height of the iframe which are discussed below: Method 1: This method uses id attribute of iframe with height property to change the height of &lt;ifr
2 min read
How to adjust the width and height of iframe to fit with content in it ?
Using iframe tag the content inside the tag is displayed with a default size if the height and width are not specified. thou the height and width are specified then also the content of the iframe tag is not displayed in the same size of the main content. It is difficult to set the size of the content in the iframe tag as same as the main content. S
3 min read
How to specify name of an iframe element using HTML ?
The iframe in HTML stands for Inline Frame. The "iframe" tag defines a rectangular region within the document in which the browser can display a separate document, including scrollbars and borders. An inline frame is used to embed another document within the current HTML document. The HTML iframe name attribute is used to specify a reference for an
1 min read
How to specify the HTML content of the page to show in the iframe element HTML5 ?
In this article, we will learn how to specify the content of a webpage to &lt;iframe&gt; in a web browser statically and dynamically by using JavaScript with HTML. We need a web browser i.e., Chrome (recommended) or Electron Application. This article will explain the proper way to assign or embed any external webpage to another webpage or even chan
2 min read
HTML width/height Attribute vs CSS width/height Property
In HTML 5, few elements follow the width and height attributes and maximum elements do not follow this attribute. Like img, iframe, canvas, and svg kind of elements follow the width and height attributes but div, span, article and section type of elements don't follow them.The width and height attributes are affected in img, svg tags, those are wea
3 min read
How to enable extra set of restrictions for content in an iframe element in HTML5 ?
In this article, we will learn how to enable an extra set of restrictions for content in an iframe element in HTML5. Below are the approaches for enabling the set of instructions. Approach: The approach of this article is to learn how to enable an extra set of restrictions for the content in an iframe element in HTML5. The task can be done by using
2 min read
three90RightbarBannerImg