Web API DOMRect bottom property
In Web API there is a DOMRect Interface which has a property bottom that gives us the bottom of the DOMRect object. It returns y + height coordinate value or if the height is negative then it returns y.
Syntax:
let recX = DOMRect.bottom;
Return Type :
Double value
Example 1: When the height is positive
HTML
<!DOCTYPE html> < html > < head > < title > DOMRect bottom property </ title > </ head > < body > < h1 style = "color:green;" > w3wiki </ h1 > < h2 >DOMRect bottom property</ h2 > < button onclick = "getDOMRect ();" > Get bottom </ button > < p id = 'DOMRect' ></ p > < script type = "text/javascript" > function getDOMRect() { let myDOMRect = new DOMRect(0, 0, 100, 100); let recbottom = myDOMRect.bottom; document.getElementById( 'DOMRect').innerHTML = recbottom; } </ script > </ body > </ html > |
Output:
Example 2: When the height is negative
HTML
<!DOCTYPE html> < html > < head > < title > DOMRect bottom property </ title > </ head > < body > < h1 style = "color:green;" > w3wiki </ h1 > < h2 >DOMRect bottom property</ h2 > < button onclick = "getDOMRect ();" > Get bottom </ button > < p id = 'DOMRect' ></ p > < script type = "text/javascript" > function getDOMRect() { let myDOMRect = new DOMRect( 0, 0, 100, -100); let recbottom = myDOMRect.bottom; document.getElementById('DOMRect').innerHTML = recbottom; } </ script > </ body > </ html > |
Output:
Supported Browsers:
- Google Chrome
- Safari 10.1
- Firefox
- Opera