HTML & CSS · Junior · Question 19 of 75
How does an element with position: relative; top: 10px behave?
- 1It sits 10px from the top of the window and doesn't move when scrolling
- 2It leaves the flow, shifts by 10px, and neighbors take its place
- ✓Correct answer: It shifts 10px down from its normal spot, but that spot in the flow is preserved
Explanation
relative visually shifts the element relative to where it would be in normal flow, but its space isn't released - neighbors don't move. relative is also often set on a parent to make it the reference point for absolutely positioned children. Positioning relative to the window is fixed.