CSS: Top vs Margin-top

后端 未结 5 524
-上瘾入骨i
-上瘾入骨i 2020-11-29 17:56

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?

5条回答
  •  [愿得一人]
    2020-11-29 18:17

    top is for tweak an element with use of position property.
    margin-top is for measuring the external distance to the element, in relation to the previous one.

    Also, top behavior can differ depending on the type of position, absolute, relative or fixed.

提交回复
热议问题