Skip to content

Instantly share code, notes, and snippets.

@timknight
Last active August 29, 2015 14:05
Show Gist options
  • Save timknight/d4fbf8ffb28d8685d89f to your computer and use it in GitHub Desktop.
Save timknight/d4fbf8ffb28d8685d89f to your computer and use it in GitHub Desktop.
Convert percentages to decimal function
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
@function decimal($percentage) {
$decimal: $percentage / 100; // Returns the number as a decimal
$decimal: $decimal / ($decimal * 0 + 1); // Removes the % unit off the number
@return $decimal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment