CSS unit converter
css_unitsConvert CSS lengths between px, rem, em, %, pt, pc, in, cm, mm, vw, vh, vmin and vmax using custom font and viewport sizes, returning all units rounded to your chosen decimal places.
Instructions
Convert a CSS length between px, rem, em, %, pt, pc, in, cm, mm, vw, vh, vmin and vmax, using a root font size, parent font size and viewport size (defaults 16px / 16px / 1440×900). Uses the CSS definition of 96px per inch. Returns every unit, rounded to 4 decimals by default. Web version: https://s3eidat.github.io/css-units/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| unit | No | Unit of "value". Default px. | px |
| value | Yes | The length to convert, e.g. 24. | |
| decimals | No | Decimal places to round to. Default 4. | |
| rootFontSize | No | Root (html) font size in px, for rem. Default 16. | |
| viewportWidth | No | Viewport width in px, for vw/vmin/vmax. Default 1440. | |
| parentFontSize | No | Parent element font size in px, for em and %. Default 16. | |
| viewportHeight | No | Viewport height in px, for vh/vmin/vmax. Default 900. |