Web API | DOMRect bottom property
In Web API there is a DOMRect Interface which has a property bottom which gives us the bottom of the DOMRect object. It returns y + height coordinate value or if the height is negative than it returns y.
Syntax:
var recX = DOMRect.bottom;
Return Type :
Double value
Example 1: When the height is positive
<!DOCTYPE html> <html> <head> <title> DOMRect bottom property </title> </head> <body> <center> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>DOMRect bottom property</h2> <button onclick="getDOMRect ();"> Get bottom </button> <p id='DOMRect'></p> </center> </body> <script type="text/javascript"> function getDOMRect() { var myDOMRect = new DOMRect(0, 0, 100, 100); var recbottom = myDOMRect.bottom; document.getElementById( 'DOMRect').innerHTML = recbottom; } </script> </html> |
Output:
Before clicking the button:

After clicking the button:

Example 2: When the height is negative
<!DOCTYPE html> <html> <head> <title> DOMRect bottom property </title> </head> <body> <center> <h1 style="color:green;"> GeeksForGeeks </h1> <h2>DOMRect bottom property</h2> <button onclick="getDOMRect ();">Get bottom</button> <p id='DOMRect'></p> </center> </body> <script type="text/javascript"> function getDOMRect() { var myDOMRect = new DOMRect(0, 0, 100, -100); var recbottom = myDOMRect.bottom; document.getElementById('DOMRect').innerHTML = recbottom; } </script> </html> |
Output:
Before clicking the button:

After clicking the button:

Supported Browsers:
- Google Chrome
- Safari 10.1
- Firefox
- Opera
Recommended Posts:
- Web API | DOMRect right property
- Web API | DOMRect top property
- Web API | DOMRect fromRect property
- Web API | DOMRect height property
- Web API | DOMRect left property
- Web API | DOMRect width property
- Web DOMRect API | DOMRect() Constructor
- CSS | bottom Property
- CSS margin-bottom Property
- CSS padding-bottom Property
- CSS border-bottom Property
- CSS | border-bottom-style Property
- CSS | border-bottom-width Property
- CSS | border-bottom-color Property
- CSS | border-bottom-right-radius 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.



