Skip to content

Instantly share code, notes, and snippets.

@erikyo
Created September 15, 2017 14:58
Show Gist options
  • Save erikyo/b6290a60599491a1a88b711b70ebcccd to your computer and use it in GitHub Desktop.
Save erikyo/b6290a60599491a1a88b711b70ebcccd to your computer and use it in GitHub Desktop.
SASS floor with precision (allow decide how many decimals floor return)
// floor with precision function
@function decimal_floor( $val , $precision: 2 ) {
$n: 1;
@for $d from 1 through $precision {
$n: $n * 10;
}
@return floor($val * $n) / $n;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment