What the difference between values, absolute and relative?? I did not understand well | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What the difference between values, absolute and relative?? I did not understand well

27th Mar 2016, 2:18 AM
Daniel Farias
Daniel Farias - avatar
4 Answers
+ 14
absolute references always refer to the location as a distance from the top left which is called 0,0 (x,y). So if you say to put something at an absolute distance of x=10 px and y=5px then it will be 10 pixels to the right of the top left corner and 5 pixels below the top left corner. Every item you say to be at this absolute location will all end up in this same exact spot. Relative position means "the position you want to move to is 'relative' (or 'in relation to') to the last location." So lets say you put an item at 10px, 5px. Then you say you want the next item to use relative positioning of 3px, 2px. Since it's relative to the last position it will put this new item at 10px + 3px for the "x" coordinate and 5px + 2px for the "y" coordinate, so it will end up at 13px, 7px for its x,y location.
20th Jun 2016, 2:37 AM
DevCoder (John Sullivan)
DevCoder (John Sullivan) - avatar
+ 2
I have never seen x,y coordinates mentioned with relative, fixed or absolute positioning. It's top, bottom, left and right that need to be set, not the x and y. These are used with background image position.
26th Jul 2016, 2:46 AM
ZinC
ZinC - avatar
+ 1
cool
18th Jul 2016, 7:13 AM
Cele Prince
Cele Prince - avatar
+ 1
Incase you are wondering, x means the horizontal axis and y means the vertical axis.
1st Aug 2016, 11:27 AM
Abdullah Zakir
Abdullah Zakir - avatar