Positions:static and absolute with "inner" and "outer" divs


#1


Replace this line with your code.


#2

when I change the position of the inner div to "absolute" and outer - to "static", the inner one is still positioned inside the outer div


#3

yea, margin will just push #inner around, but to prove that absolute is position relative to the html document, see what happens when add this:

#inner {
  right: 0;
}

the problem is that this lesson is lacking in explanation. please read the explanation i wrote here;

that should clarify a thing or two, ask if you have any questions afterwards


#4

thank u for your answer, but I still think the explanation in the lesson somewhat contradicts what is actually seen in practise, since if #inner is absolute and #outer - static, the margin of the outer affects the position of the #inner, therefore the position of the #inner is still so to say "relative" to some conditions of the #outer`s position))))


#5

yes, this is true, till some extend. the div follows block level structure, given the nesting of the inner div in the outer div, however, what the exercise is saying (or should be saying) is that when using left, right, top and bottom the absolute will position to the first non static parent, in case there is no non static parent, it positions relative to the document.

Did you read my more extensive explanation in the answer i linked to?


#6

Yes, thank U for clarifying everything:wink:


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.