Prince Documentation
  • Documentation
  • Help
  • Release Notes

›CSS Support

Installation Guide

  • Getting Started
  • Your First Document
  • Help

User Guide

  • Convert HTML to PDF
  • Styling
  • Paged Media
  • Generated Content
  • Scripting
  • Graphics
  • Prince Tips and Tricks
  • Help
  • Prince Input
  • Prince Output
  • Prince Networking
  • Server Integration
  • Prince for Books

Reference Guide

    CSS Support

    • Length & Angle Units
    • CSS Properties
    • CSS Selectors
    • CSS Media Queries
    • CSS Functional Expressions
    • CSS At-rules
    • Color Names
    • Supported CSS Specifications
  • JavaScript Support
  • Command-line Options
  • Miscellaneous

    • Page Size Keywords
    • Character Entities
  • Acknowledgments

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 has rotate and skew 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 property takes multiples of 90deg.
← Prince for BooksCSS Properties →
  • Absolute Length Units
  • Font Length Units
  • Viewport Length Units
  • Pixel Unit
  • Angle Units
About us | Privacy Policy | Contact
Copyright © 2023 YesLogic Pty. Ltd.