🎨 HTML / CSS
Beginner
What is the CSS position property and what are its values?
Answer
The CSS position property controls how an element is placed in the document flow. static (default): the element follows normal document flow; top/left/right/bottom have no effect. relative: element stays in the normal flow but can be offset with top/left etc. relative to its original position, without affecting surrounding elements. absolute: element is removed from flow and positioned relative to its nearest non-static ancestor. fixed: element is removed from flow and positioned relative to the viewport — it stays put when scrolling. sticky: behaves as relative until the element scrolls to a threshold, then becomes fixed — used for sticky headers.