Created
July 14, 2012 14:04
-
-
Save xl1/3111497 to your computer and use it in GitHub Desktop.
SCSS で単位を落とす
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@function int($x) { | |
$list: (); | |
@for $i from floor($x - $x) to floor($x) { | |
$list: append($list, 0); | |
} | |
@return length($list); | |
} | |
*/ | |
// もっとよいやり方がある | |
@function num($x){ | |
@return $x / (1 + $x - $x); | |
} | |
@debug num(1px); // -> 1 | |
@debug num(40em); // -> 40 | |
@debug num(23.4%); // -> 23.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment