Skip to content

Instantly share code, notes, and snippets.

@babsgosgens
Created August 7, 2013 09:41
Show Gist options
  • Save babsgosgens/6172647 to your computer and use it in GitHub Desktop.
Save babsgosgens/6172647 to your computer and use it in GitHub Desktop.
// Accepts a value and returns it without a value
@function return-unitless($value)
{
@if unitless($value) {
@return $value;
}
$unit: unit($value);
@if $unit=="px" {
@return $value / 1px;
}
@if $unit=="rem" {
@return $value / 1rem;
}
@if $unit=="em" {
@return $value / 1em;
}
@if $unit=="%" {
@return $value / 1%;
}
@if $unit=="pt" {
@return $value / 1pt;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment