convert-css-length
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "convert-css-length", | ||
"description": "Convert between css lengths e.g. em->px or px->rem", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Kyle Mathews <mathews.kyle@gmail.com>", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -7,2 +7,4 @@ # convert-css-length | ||
*[Note: algorithm was originally ported from Compass] (https://github.com/Compass/compass/blob/master/core/stylesheets/compass/typography/_units.scss)* | ||
## Install | ||
@@ -16,3 +18,3 @@ `npm install convert-css-length` | ||
// Set the baseFontSize for your project. Defaults to 16px (also the | ||
browser default). | ||
// browser default). | ||
var convert = convertLength('21px'); | ||
@@ -27,2 +29,9 @@ | ||
// ---> 1.875em | ||
// Convert em to pixels using fromContext. | ||
// em(s) are relative to the font-size at the same node. If you're setting an em on a node whose font-size | ||
// is different than the base font size, you'll need to pass that font-size as the third parameter. | ||
// Or just use rem instead which sizes everything relative to the base node. | ||
convert('1em', 'px', '14px') | ||
// ---> 14px | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
222329
35