Skip to main content

Length Units

@see https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units

// Examples
width: '100vw',
fontSize: '10em',
transform: [{ scale: '10px' }],
borderRadius: '100vh',
info

By default (if no unit is specified), 'px' will be used.

e.g.: 5 = 5px

Available length units#

Absolute#

UnitNameImplementedEquivalent to
cmCentimeters☑️1cm = 38px = 25/64in
mmMillimeters☑️1mm = 1/10th of 1cm
QQuarter-millimeters☑️1Q = 1/40th of 1cm
inInches☑️1in = 2.54cm = 96px
pcPicas☑️1pc = 1/6th of 1in
ptPoints☑️1pt = 1/72th of 1in
pxPixels☑️1px = 1/96th of 1in

Relative#

UnitImplementedRelative to
em⚛️Font size of the parent, in the case of typographical properties like font-size, and font size of the element itself, in the case of other properties like width.
ex⚛️x-height of the element's font.
ch⚛️The advance measure (width) of the glyph "0" of the element's font.
rem⚛️Font size of the root element.
lh⚛️Line height of the element.
vw☑️1% of the viewport's width.
vh☑️1% of the viewport's height.
vmin☑️1% of the viewport's smaller dimension.
vmax☑️1% of the viewport's larger dimension.

⚛️ Mock, uses default font size of 16. If you have an idea of how to implement, please submit a PR.