MEANING OF Relative And Absolute | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

MEANING OF Relative And Absolute

What does being absolute or relative mean?

16th Jun 2019, 3:35 AM
THE GAMOSPHERE
THE GAMOSPHERE - avatar
4 Answers
+ 2
relative is relative to the element's "normal flow" in the page. For example, if you have an element that is normally 5px from the top of the page, setting position to relative and top to 10px will move the element an additional 10px AWAY from the top of the page. Absolute is relative to the closest parent element (defaulting to the <body> element). The best way to visualise this is if you put a <div> with absolute position and put it in another <div> the one inside will visually be inside the other div, potentially overlapping at points
16th Jun 2019, 5:07 AM
Jackson O’Donnell
+ 2
In what context?
16th Jun 2019, 4:06 AM
Jackson O’Donnell
+ 2
In positioning elements as well as in src's/href's of images,links,etc.
16th Jun 2019, 4:31 AM
THE GAMOSPHERE
THE GAMOSPHERE - avatar
+ 2
And defining absolute position with images requires to state height and width both? I heard a rule something like this...
16th Jun 2019, 5:38 AM
THE GAMOSPHERE
THE GAMOSPHERE - avatar