CSS 中文开发手册
顶部边距 | margin-top (Basic Box Model) - CSS 中文开发手册
margin-top 属性用来设置元素的顶部外边距,你也可以使用负值。
/* values */
margin-top: 10px; /* An absolute length */
margin-top: 1em; /* relative to the text size */
margin-top: 5%; /* relative to the nearest block container's width */
/* Keyword values */
margin-top: auto;
/* Global values */
margin-top: inherit;
margin-top: initial;
margin-top: unset;
初始值
0
适用元素
all elements, except elements with table display types other than table-caption, table and inline-table. It also applies to ::first-letter.
是否是继承属性
no
Percentages
refer to the width of the containing block
适用媒体
visual
计算值
the percentage as specified or the absolute length
Animation type
a length
正规顺序
<