Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
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)