Skip to content
Related Articles

Related Articles

HTML | DOM embed height property

View Discussion
Improve Article
Save Article
  • Last Updated : 21 Jul, 2022
View Discussion
Improve Article
Save Article

The embed height property in HTML DOM is used to set or return the value of the height attribute. The height attribute defines the height of the embedded content in terms of pixels. 

Syntax:

  • Return the height property:
embedObject.height
  • Set the height property:
embedObject.height = pixels

Property Values:

  • px: Specify the height in pixels of the embedded content.

Return value: It returns a number to show the height of embedded content. 

Example: 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Embed height Property
    </title>
</head>
 
<body>
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
 
        <embed id="embedID" height="400"
            src="https://ide.geeksforgeeks.org">
        <br>
         
        <button onclick="GFGfun()">
            Try it
        </button>
 
        <p id="pid"></p>
 
        <script>
            function GFGfun() {
                var idheight =
                document.getElementById("embedID").height;
                 
                document.getElementById("pid").innerHTML
                        = idheight;
            }
        </script>
    </center>
</body>
 
</html>

Output: Before click on button:

  

After click on button:

  

Example: 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML DOM Embed height Property
    </title>
</head>
 
<body>
    <center>
        <h1 style="color:green">
            GeeksforGeeks
        </h1>
 
        <embed id="embedID"
            src="https://ide.geeksforgeeks.org">
        <br>
 
        <button onclick="GFGfun()">
            Try it
        </button>
 
        <p id="pid"></p>
 
        <script>
            function GFGfun() {
                var idheight =
                document.getElementById("embedID").height
                        = 400;
                 
                document.getElementById("pid").innerHTML
                        = idheight;
            }
        </script>
    </center>
</body>
 
</html>

Output:

Before clicking the button:

 

After clicking the button:

 

Supported Browsers: The browsers supported by DOM embed height property are listed below:

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer 6 and above
  • Firefox 1 and above
  • Safari 4 and above
  • Opera 12.1 and above

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!