Open In App

Web API DOMRect height property

Last Updated : 15 Jun, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

In Web API there is a DOMRect Interface that has a property height which gives us the height of the DOMRect object. 

Syntax:

letrecX = DOMRect.height;

Return Type:

Double value

Example: Getting the height of the DOMRect object created. 

HTML
<!DOCTYPE html>
<html>

<head>
    <title>DOMRect height property</title>
</head>

<body>
    <h1 style="color:green;">
        GeeksForGeeks
    </h1>
    <h2>DOMRect height property</h2>
    <button onclick="getDOMRect ();">
        Get height
    </button>
    <p id='DOMRect'></p>
  
    <script type="text/javascript">
        function getDOMRect() {
            let myDOMRect = new DOMRect(0, 0, 100, 100);
            let recheight = myDOMRect.height;
            document.getElementById(
                'DOMRect').innerHTML = recheight;
        }
    </script>
</body>
  
</html>

Output:

 

Supported Browsers: The browsers supported by the DOMRect height property are listed below:

  • Google Chrome
  • Safari 10.1
  • Firefox
  • Opera

Next Article

Similar Reads