fn
pxValue
v0.0.5testedParse a CSS length token ("1024px", "48em", "30rem",
"50%") into a pixel number. em/rem use the conventional 16px root size.
Returns NaN for non-numeric input.
Example
ts
pxValue('30rem'); // 480
pxValue('1024px'); // 1024Signature
ts
export function pxValue(value: string): number{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | The CSS length token to parse |
Returns
numberThe value in pixels, or NaN when not parseable