1.0.1 • Published 7 years ago

px-to-em v1.0.1

Weekly downloads
8
License
-
Repository
-
Last release
7 years ago

px-to-em

Convert a px value to an em value. That is, given a px value and an element, determine the equivalent em.

Usage

If you use ES modules, and if you use package.json then import px-to-em, otherwise import pxToEm.mjs. Alternatively, include pxToEm.js in scope.

Given this HTML:

<p id="message" style="font-size: 16px;">Hello World!</p>

You can expect these outputs:

pxToEm(16, message) === 1
pxToEm(32, message) === 2

Development

Run npm run develop to continuously rebuild the project.

Start a web server in the test directory, visit index.html in a browser, and check your console to see if the tests are passing.