top
介绍
top
属性定义了定位元素的上外边距边界与其包含块上边界之间的偏移,非定位元素设置此属性无效。定位元素参考position 属性。
取值
auto
<length>
固定的的值<percentage>
参照于包含块高度的百分比默认值 auto
样例:
/* <length> */
top: 3px;
top: 2rpx;
top: 2.4em;
top: 3rem;
top: 10%;
/* Keyword value */
top: auto;
top: calc(1px + 1px);
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
标准化语法
auto | <length> | <percentage>
1
与 Web 的区别
暂时不支持 inherit、initial、revert、unset 等取值。