CSS单位速查表
px
:绝对像素值rem
:相对于根元素的font-size
em
:相对于元素的font-size
%
:相对于父元素vw
:相对于视口宽度,1vw
=1%
* 视口宽度vh
:相对于视口高度,1vh
=1%
* 视口高度vmin
:相对于视口较小的尺寸,1vmin
= min(1vh
,1vw
)vmax
:相对于视口较大的尺寸,vmax
= max(1vh
,1vw
)ch
:相对于元素字体的字符 "0" 的宽度in
:英寸,1in
=2.54cm
=96px
pc
:派卡,1pc
=1in
/6
=16px
pt
:点,1pt
=1in
/72
=1.333px
(近似值)cm
:厘米,1cm
=96px
/2.54
=37.8px
(近似值)mm
:毫米,1mm
=1cm
/10
=3.78px
(近似值)