1
web-units-conversify
source link: https://www.npmjs.com/package/web-units-conversify
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Welcome to web-units-conversify 👋
Javascript library for converting pixels, viewports and REM units!
This package is mainly made to convert CSS measurement units from HTML elements from one kind to another.
Install
yarn add web-units-conversify
npm install web-units-conversify
Author
👤joao alberto cambauva
Show your support
Give a ⭐️ if this project helped you!
How to use the package:
import {
pixelsToREM,
remToPixels,
remToVH,
remToVW,
vhToREM,
vwToREM,
pixelsToVH,
pixelsToVW,
vhToPixels,
vwToPixels,
} from "web-units-conversify";
console.log(remToPixels(10) + "px");
console.log(pixelsToREM(1024) + "rem");
console.log(remToVH(12) + "vh");
console.log(vwToREM(15) + "em"); // can be EM or REM
console.log(remToPixels(10) + "px"); console.log(pixelsToREM(1024) + "rem"); console.log(remToVH(12) + "vh"); console.log(vwToREM(15) + "em"); // can be EM or REM
//etc...
ENJOY! =)
https://github.com/joaocambauva/web-units-conversify
You Can Contribute Here If You Want To! Cheers!https://www.npmjs.com/package/web-units-conversify
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK