Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Created May 1, 2012 16:15
Show Gist options
  • Save rogeruiz/2569286 to your computer and use it in GitHub Desktop.
Save rogeruiz/2569286 to your computer and use it in GitHub Desktop.
Responsive Sass Function
// @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