Last active
July 6, 2018 12:15
-
-
Save amitabhaghosh197/0176344cb49ba93a1447101c85586137 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com. #sass, #scss, #decimal round
This file contains hidden or 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
> 1% | |
last 2 versions |
This file contains hidden or 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
// ---- | |
// Sass (v3.4.25) | |
// Compass (v1.0.3) | |
// ---- | |
@function decimal-round ($number, $digits: 0, $mode: round) { | |
$n: 1; | |
// $number must be a number | |
@if type-of($number) != number { | |
@warn '#{ $number } is not a number.'; | |
@return $number; | |
} | |
// $digits must be a unitless number | |
@if type-of($digits) != number { | |
@warn '#{ $digits } is not a number.'; | |
@return $number; | |
} @else if not unitless($digits) { | |
@warn '#{ $digits } has a unit.'; | |
@return $number; | |
} | |
@for $i from 1 through $digits { | |
$n: $n * 10; | |
} | |
@if $mode == round { | |
@return round($number * $n) / $n; | |
} @else if $mode == ceil { | |
@return ceil($number * $n) / $n; | |
} @else if $mode == floor { | |
@return floor($number * $n) / $n; | |
} @else { | |
@warn '#{ $mode } is undefined keyword.'; | |
@return $number; | |
} | |
} | |
@mixin eq-flex-cols($n){ | |
$w : decimal-round(percentage(1/ $n), 2, round); | |
flex: 1 0 $w; | |
max-width:$w; | |
} | |
.col{ | |
@include eq-flex-cols(3); | |
} |
This file contains hidden or 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
.col { | |
-webkit-box-flex: 1; | |
-webkit-flex: 1 0 33.33%; | |
-ms-flex: 1 0 33.33%; | |
flex: 1 0 33.33%; | |
max-width: 33.33%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment