CSS:顶部vs Margin-top [英] CSS: Top vs Margin-top

查看:133
本文介绍了CSS:顶部vs Margin-top的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道我是否完全理解这两者之间的区别。

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

有人可以解释为什么我会使用一个和另一个,他们有什么区别? / p>

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

推荐答案

顶部是用于tweak使用 position 属性。

margin-top 用于测量元素的外部距离

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.

这篇关于CSS:顶部vs Margin-top的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆