Skip to main content

Length & Angle Units

Prince supports the following length and angle units:

Absolute Length Units​

The absolute length units correspond to exact distances in the PDF file.

Absolute length units

cm

centimeters

mm

millimeters

q

quarter-millimeters

in

inches

pc

picas

pt

points

Font Length Units​

The font length units are relative to the font-size property.

Font length units

em

font size of the element

rem

font size of the root element

ex

x-height in the current font

rex

x-height in the font of the root element
Line height units

lh

line height of the element

rlh

line height of the root element
Character units

ch

width of the "0" (zero) glyph in the current font

rch

width of the "0" (zero) glyph in the font of the root element
CapHeight units

cap

nominal height of capital letters in the current font

rcap

nominal height of capital letters in the font of the root element
Ideographic units

ic

width of the "水" glyph (CJK water ideograph, U+6C34) in the current font

ric

of the "水" glyph (CJK water ideograph, U+6C34) in the font of the root element

Viewport Length Units​

The viewport length units are relative to the @page area: the unit vw is equal to 1% of the width of the page area, i.e. the page size minus the margin area (and minus border and padding), while the unit vh is equal to 1% of its height.

The values pvw and pvh are equal to respectively 1% of the width and height of the entire page, as defined by the page size.

Please note that these values cannot be used with elements for which a viewport, such as the root element, has not been established.

Viewport length Units

vw

content area width

vh

content area height

vmin

the smaller length of vw or vh

vmax

the larger length of vw or vh

pvw

page width

pvh

page height

pvmin

the smaller length of pvw or pvh

pvmax

the larger length of pvw or pvh

Pixel Unit​

The pixel unit is relative to the de-facto standard of 96dpi (or rather, 96 pixel per inch) for compatibility with browsers.

Pixel unit

px

pixel
tip

This can be changed with the command-line option --css-dpi.

Fractional Length Unit​

CSS grids require a flexible length, expressed as a fraction of the leftover space in a grid container.

Fractional length unit

fr

fraction of the leftover space in the grid container

Angle Units​

Furthermore, Prince supports the four angle units deg, grad, rad and turn on the following properties: