+ 3
Stuck with position property
I’m just learned position property and I don’t understand.. How relative behave next to absolute in the same screen? I mean why one time absolute is above the relative and one time it’s under relative I don’t get it.. help???
13 ответов
+ 3
I'll try to be simple. Basically we give relative position to the parent div and absolute give to its child. When you dont give relative position the absolute div considers whole body as its parent. Hope you'll understand I tried to explain in simple words
+ 3
Check this code i made real quick. You will see 3 divs red one is parent div which have one blue div that is its child div, and one more orange div that is free div. I gave same styling to blue and orange div. I gave them both bottom 0. Both are at the bottom of there parents
https://code.sololearn.com/WN4pZM9RVIXG/?ref=app
+ 3
Is your question about this code?
https://code.sololearn.com/WlBmCdasp0k1/?ref=app
+ 1
What the meaning of “parent “ and “child”?
+ 1
Yea i understand the child and parent thing now but what if i weite four paragrahps and all of them are free div?
+ 1
How then the absulote and relative will act to each other?
+ 1
If you can again check the code, ive added 2 more divs in child1, parent2 and child2 but child2 leave the flow and considers child1 as its parent coz child1 has position that is absolute but parent2 has not any position (by default every element have static position). Positions are lil bit confusing so take your time and do more practice. For more clean understanding you could get help from yt.
Ps: every time you havent gave position to parent then their parent is body no matter how much childs are
0
Yea
0
I don’t get it why I write absolute to the second article but its only effected on the first article but not effecting on the third article..??
0
Can I explain that?(so appreciate your help btw)
0
Hi listen , my only question is how relative and absolute behave on the same screen, for example if the first section and third section will be relative and second section will be absolute..?
What you showed me is how static and relative or absolute behave on the same screen.. i understand that cleearly, just don’t understand how the element will be placed when two of them are relative and one of them is absolute..
0
Can you explain me that? What the order of priority between them?
0
Hi Qurban, I found my answer thanks for help, the answer I was need was the order of the position in general: (relative,absolute<-static), this is the order of front and behind and for cases ther is multipe element with the same position the order of them is that the last element we wrote on html in frontest and the first we wrote is in behindest..