top and left values | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

top and left values

I tried to replicate some webpages like gmail and Facebook's home page.. I saw the source code on net and i had a query.. How do i determine the value of 'top' and 'left' in px while positioning in css?

22nd Jun 2017, 8:26 PM
Rajat Karnwal
Rajat Karnwal - avatar
1 Answer
0
You can use offsetTop and offsetLeft properties in JavaScript to determine the top/left values. Or if you are using a library like jQuery, you can use the offset() method to retrieve the top/left values.
22nd Jun 2017, 8:57 PM
Alex