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 of the element's font |
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 |
Angle Units
Furthermore, Prince supports the four angle units deg
, grad
, rad
and turn
on the following properties:
- the CSS
transform
property hasrotate
,skew
andskewx
/skewy
operators; - linear gradients have an angle;
hsl
/hsla
colors have a hue angle;- the
hue-rotate
filter takes an angle; - the
@page
-prince-rotate-body
descriptor takes multiples of90deg
.
Line Height Units
Only supported by Prince for Books are line height units.
If line-height
is set to normal
, then these units currently
use the approximation of 1.2
instead of using the exact font-metrics.
Line height units | |
---|---|
lh |
line height of the element |
rlh |
line height of the root element |