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


<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>


Replace this line with your code.

<do not remove the three backticks above>

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

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

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))))

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?

1 Like

Yes, thank U for clarifying everything:wink:

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