Skip to content

Instantly share code, notes, and snippets.

@krisbulman
Created July 31, 2012 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisbulman/3217486 to your computer and use it in GitHub Desktop.
Save krisbulman/3217486 to your computer and use it in GitHub Desktop.
CSS Summit - PX to EM
// Thanks to Chris Eppstein for this gem
$base-line-height: 18px !default;
$base-font-size: 13px !default;
$base-em-ratio: 1em / $base-font-size !default; // used by the px-to-em function below
// Converts px to em in case you do need relative units in your output.
@function px-to-em($value, $em-ratio: $base-em-ratio) {
@return $value * $em-ratio;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment