positions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

positions

i dont understand what the point of absolute and relative positions, what is the diffrent? for example i have got a div element inside another div element, and i change the inside div position to relative, thats wil be just the normal flow in the parent div element, and if i change the inside div element position to absolulte, thats also the normal flow of the parent div element, so i do not need position and just use the normal flow of the page.. can anyone give me example to the changes of diffrent positions?

3rd Oct 2016, 10:20 AM
ran gantz
ran gantz - avatar
2 Answers
0
Hey! You can merge W3Schools tutorials while you are learning, if you have any questions. Here is a good explanation for your question: http://www.w3schools.com/css/css_positioning.asp
4th Oct 2016, 7:19 PM
Scotti
Scotti - avatar
0
Relative and absolute positioning gave me a hell of a time as well. There are actually 4 states elements can be in: Static which is default, relative, absolute and fixed. Relative will set it relative to whatever container its in. I think you've got a good understanding of that by the sound of it. Absolute on the other hand you can change position of. Where static will ignore positions and relative will always set it relative to. #inthediv { position: absolute; left: 15px; right:10px; bottom:150px; top:-50px; } Adding which direction top, left, bottom and right with a number you can move the container around inside of whatever container its in. its a lot more percise though can get a lot more complicated then simply floating left or right.
11th Oct 2016, 11:57 AM
Scott Brown
Scott Brown - avatar