Welcome to the Treehouse Community
Looking to learn something new?
How do can I determine the exact position "coordinates" I need to use?
For example, if I want a coin right in this spot, then how do I know which x and y values exactly I need to use?
Mohammed Munier Hamoud Shikh1,616 Points
You can bring a paper and draw a rectangle (8 cm width,6 cm height) , 1cm=100 pixel. then divide it with roller , every 1 cm draw a line, in the end you will have a grid , every connect point have a value. That's the same thing with those values in Screen. http://1.bp.blogspot.com/_TDPzTFmd880/TVB5MtBIAHI/AAAAAAAAApM/wsA3HUzULtU/s400/grid.PNG Ask me if you have another question, i am new also but it is better to work together
Antonio VargasCourses Plus Student 4,174 Points
Saiful Azhar2,510 Points
var elem = document.getElementsByTagName("em");
var elem = document.getElementsById("em");
or any other selector.
Then, having the element, you can call
var result = elem.getBoundingClientRect();
Which you'll then be able to access all 4 dimension of the elements coordinates
console.log(result.top, result.right, result.bottom, result.left)