Positioing:absolute and positioning:static do not change anything


#1

At the exercise 18.Absolute positioning, I played around changing the position attribute to both #outter and #inner boxes, and they behave the same.


#2

They absolutely are not the same, these answers take a lot of time to read, so please read this first, if you have any questions afterwards, i will answer them. When asking questions, be specific, show us code


#3

I think that there is a mistake in that exercise. I believe the intended property we wanted to define was "left: 20px;", but instead we are instructed to set "margin-left" to 20px. When using the "left: 20px;" definition there is a noticeable difference as to how the divs are positioned when setting the outer div's position either to "static" or "absolute.

Edit: There seems to be a similar mistake in the next exercise as well; the instructions tell us to change the "margin-left" property when we should be changing the "left" property instead.


#4

The explanation in the lesson is good, in fact, it is very true if you use left, right, top and bottom. Margin will just move the element around.


#5

In exercise 18, even after setting outer position to static , inner block is changing position with respect to outer and not with the html.


#6

I had the exact same thought and I'm getting confused. I thought that by making #outer static, then #inner (whose position is absolute) would change position relative to html, but its still acting like #outer is absolute.


#7

It would, if you used left, right, bottom and top. Margin is just pushing it around.


#8

I'm not certain, but there seems to be a problem with positioning on the Codecademy preview window (at least in IE 11, which I'm stuck using...) which might be the cause of some confusion. In the JSbin examples in the answer the mod links to it works well, but in the codecademy exercise nothing happens.


#10

Please create a new topic with your code, so someone can help you. If this not involve struggling to get pass an exercise, please specify as such. Also think carefully about your question (if there are bins involved, link both to the bin, and your code, and why you think it is not working in codecademy (expected vs actual output))