Length Units
@see https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units
info
By default (if no unit is specified), 'px' will be used.
e.g.: 5 = 5px
Available length units#
Absolute#
| Unit | Name | Implemented | Equivalent to |
|---|---|---|---|
| cm | Centimeters | ☑️ | 1cm = 38px = 25/64in |
| mm | Millimeters | ☑️ | 1mm = 1/10th of 1cm |
| Q | Quarter-millimeters | ☑️ | 1Q = 1/40th of 1cm |
| in | Inches | ☑️ | 1in = 2.54cm = 96px |
| pc | Picas | ☑️ | 1pc = 1/6th of 1in |
| pt | Points | ☑️ | 1pt = 1/72th of 1in |
| px | Pixels | ☑️ | 1px = 1/96th of 1in |
Relative#
| Unit | Implemented | Relative 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.