Open In App

HTML DOM IFrame height Property

Last Updated : 20 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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.height
  • It is used to set the height property. 
iframeObject.height = pixels

Property Values: 

  • pixels: It specifies the height of the Iframe Element in terms of pixels

Return Value It returns a string value that represents the height of the Iframe in terms of pixels.

Example 1: This Example illustrates how to return the Iframe height Property. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM iframe height Property
    </title>
</head>
   
<body style="text-align:center;">
    <h1>GeeksforGeeks</h1>
    <h2>
          HTML DOM iframe height Property
      </h2>
    <iframe src="inde1.html"
            id="GFG" height="200"
            width="400">
    </iframe>
    <br>
    <br>
    <button onclick="Geeks()">
          Submit
      </button>
    <p id="sudo" style="font-size:20px"></p>
 
    <script>
        function Geeks() {
            let x =
                document.getElementById("GFG").height;
            document.getElementById("sudo").innerHTML = x;
 
        }
    </script>
 
</body>
 
</html>


Output:

 

Example 2: This Example illustrates how to set the Iframe height Property. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM iframe height Property
    </title>
</head>
 
<body style="text-align:center;">
    <h1>GeeksforGeeks</h1>
    <h2>
          HTML DOM iframe height Property
      </h2>
    <iframe src="inde1.html"
            id="GFG"
            height="200"
            width="400">
    </iframe>
    <br>
    <br>
    <button onclick="Geeks()">
          Submit
      </button>
    <p id="sudo"
       style="font-size:20px">
      </p>
 
    <script>
        function Geeks() {
            let x =
                document.getElementById("GFG").height =
                "400";
            document.getElementById("sudo").innerHTML = x;
        }
    </script>
</body>
 
</html>


Output:

 

Supported Browsers: The browsers supported by HTML DOM IFrame height Property are listed below: 

  • Google Chrome 1.0 and above
  • Edge 12.0 and above
  • Firefox 
  • Internet Explorer
  • Opera 
  • Safari  


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads