Created
May 1, 2012 16:15
-
-
Save rogeruiz/2569286 to your computer and use it in GitHub Desktop.
Responsive Sass Function
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
// @name Responsive Function | |
// @desc A function that returns a percentage or ems for a rwd approach | |
// @param $target The target size | |
// @param $context The size of the parent of the target size | |
// @param [Optional] $t The type of calculation (defaults to percent) | |
// @author Roger Steve Ruiz | |
// @email [email protected] | |
@function r($target, $context, $t: percent) { | |
@if $t == 'percent' { | |
@return ($target / $context) * 100%; | |
} @else { | |
@return ($target / $context) * 1em; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment