Created
June 25, 2019 18:52
-
-
Save gabemeola/84e06640cf7e0748b86b085933b60cce to your computer and use it in GitHub Desktop.
px to rem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns rem representation of pixel based on root size. | |
* | |
* @param {number} px - Pixel Size | |
* @param {number} [rootSize=16] - Root Font Size | |
* @returns {string} | |
*/ | |
export default function pxToRem(px: number, rootSize: number = 16): string { | |
return `${px / rootSize}rem`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment