CSS: Top vs Margin-top

Viewed 69378

I'm not sure if I fully understand the difference between these two.

Can someone explain why I would use one over the other and how they differ?

6 Answers

This is my understanding...

TOP: it defines the position of the element wrt its own elements or other element i.e in case of relative top refers to compare with its own element whereas in fixed top refers to compare with viewport.

Margin_Top: it always refer to its own elements that adds an offset(outside) to its border

Related