长度单位包括
相对长度单位包括:em, ex, ch, rem, vw, vh, vmax, vmin
绝对长度单位包括:cm, mm, q, in, pt, pc, px
ch:数字“0”的宽度
em:相对于当前对象内文本的字体尺寸。如当前对行内文本的字体尺寸未被人为设置,则相对于浏览器的默认字体尺寸。
ex:相对长度单位。相对于字符“x”的高度。通常为字体高度的一半。如当前对行内文本的字体尺寸未被人为设置,则相对于浏览器的默认字体尺寸。
rem:相对于根元素(即html元素)font-size计算值的倍数
vw:相对于视口的宽度。视口被均分为100单位的vw
vh:相对于视口的高度。视口被均分为100单位的vh
vmax:相对于视口的宽度或高度中较大的那个。其中最大的那个被均分为100单位的vmax
vmin:相对于视口的宽度或高度中较大的那个。其中最大的那个被均分为100单位的vmax
cm:厘米 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
mm:毫米 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
q:1/4毫米 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
in:英寸 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
pt:点 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
pc:派卡 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
px:像素 1in = 2.54cm = 25.4 mm = 101.6q = 72pt = 6pc = 96px
Pixels |
EMs |
Percent |
Points |
6px |
0.375em |
37.5% |
5pt |
7px |
0.438em |
43.8% |
5pt |
8px |
0.5em |
50% |
6pt |
9px |
0.563em |
56.3% |
7pt |
10px |
0.625em |
62.5% |
8pt |
11px |
0.688em |
68.8% |
8pt |
12px |
0.75em |
75% |
9pt |
13px |
0.813em |
81.3% |
10pt |
14px |
0.875em |
87.5% |
11pt |
15px |
0.938em |
93.8% |
11pt |
16px |
1em |
100% |
12pt |
17px |
1.063em |
106.3% |
13pt |
18px |
1.125em |
112.5% |
14pt |
19px |
1.188em |
118.8% |
14pt |
20px |
1.25em |
125% |
15pt |
21px |
1.313em |
131.3% |
16pt |
22px |
1.375em |
137.5% |
17pt |
23px |
1.438em |
143.8% |
17pt |
24px |
1.5em |
150% |
18pt |