In Web API there is a DOMRect Interface which has a property height which gives us the height of the DOMRect object.
Syntax:
var recX = DOMRect.height;
Return Type:
Double value
Example: Getting height of the DOMRect object created.
<!DOCTYPE html> <html> <head> <title>DOMRect height property</title> </head> <body> <center> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>DOMRect height property</h2> <button onclick="getDOMRect ();"> Get height </button> <p id='DOMRect'></p> </center> </body> <script type="text/javascript"> function getDOMRect() { var myDOMRect = new DOMRect(0, 0, 100, 100); var recheight = myDOMRect.height; document.getElementById( 'DOMRect').innerHTML = recheight; } </script> </html> |
chevron_right
filter_none
Output:
Before clicking the button:

After clicking the button:

Supported Browsers: The browsers supported by DOMRect height property are listed below:
- Google Chrome
- Safari 10.1
- Firefox
- Opera
Recommended Posts:
- Web DOMRect API | DOMRect() Constructor
- Web API | DOMRect fromRect property
- Web API | DOMRect width property
- Web API | DOMRect right property
- Web API | DOMRect left property
- Web API | DOMRect top property
- Web API | DOMRect bottom property
- Web ImageData API | ImageData.height property
- Web HTMLCanvasElement API | CanvasElement height property
- Differences between Web Services and Web API
- Web 1.0, Web 2.0 and Web 3.0 with their difference
- HTML width/height Attribute vs CSS width/height Property
- Web Window API | Window locationbar property
- Web Audio API | AudioContext outputLatency property
- Web Audio API | AudioNode numberOfOutputs property
- Web Audio API | AudioNode numberOfInputs Property
- Web Audio API | AudioNode context property
- Web Window API | Window scrollbars property
- Web HTMLStyleElement API | StyleElement type property
- Web StyleElement API | StyleElement media property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


