What is the difference between these two positioning properties? Is one better to use than the other?

1 answer

This was chosen as the best answer

Margin adds an area around your element. position: absolute completely removes that element from the flow of the page and anchors it, by default at the top left of your screen.

Margin and position are not really related at all. Margin can be compared to padding though. Margin is the area outside and element, padding is adding space to the inside of an element.

Check these sources for me information:




Answered about 10 years ago by Ben Shoults