中文 Back to tools

CSS Length Unit Explorer

Compare absolute and relative CSS units in one environment, and see how they respond to font and viewport changes.

Unit comparison

First value
Second value
- -

单位对照表

Each row shows one unit with an illustration bar and approximate pixels; ex and ch are browser estimates.
绝对单位
Unit Description Visualization 计算值 (px)
cmcentimeters
-
mmmillimeters
-
Qquarter-millimeters
-
in英寸 (1in = 96px)
-
pc派卡 (1pc = 16px)
-
ptpoints (1pt = 1/72in)
-
pxpixels (relative to the device)
-
相对单位
Unit Description Visualization 计算值 (px)
emrelative to the element font size
-
remrelative to the root element font size
-
exrelative to the height of character "x"
-
chrelative to the width of character "0"
-
vw1% of viewport width
-
vh1% of viewport height
-
vmin1% of the smaller viewport dimension
-
vmax1% of the larger viewport dimension
-
%relative to the parent element (usually width)
-
caprelative to capital-letter height
-
icrelative to ideographic-character width
-
lhrelative to its own line height
-
rlhrelative to the root element line height
-
virelative to viewport inline size
-
vbrelative to viewport block size
-