Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including css-length with all npm packages installed. Try it out:

let CSSLength = require('css-length'); // play around! change the length, base, or formatter, and see the output let length = new CSSLength('24px', { base: 16, formatter: (value, unit) => value + unit }); console.log(`raw length: ${length.raw}`); console.log(`orig unit: ${length.unit}`); console.log(`orig value: ${length.value}`); console.log(`base pixel size: ${length.$config.base}`); console.log(`length.cm: ${length.cm}`); console.log(`length.em: ${length.em}`); console.log(`length.in: ${length.in}`); console.log(`length.mm: ${length.mm}`); console.log(`length.pc: ${length.pc}`); console.log(`length.pct: ${length.pct}`); console.log(`length.pt: ${length.pt}`); console.log(`length.px: ${length.px}`); console.log(`length.rem: ${length.rem}`);

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

css-length v1.0.3

CSS length parser and converter library.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free