Skip to content

Instantly share code, notes, and snippets.

@jeffarese
Created May 30, 2016 23:51
Show Gist options
  • Save jeffarese/ce64dac07af304d91688394a9cbce00a to your computer and use it in GitHub Desktop.
Save jeffarese/ce64dac07af304d91688394a9cbce00a to your computer and use it in GitHub Desktop.
Sass Calc mixin
/**
* @description
* Generates the calc values for cross browser compatibility
*
* @author Jeffarese
*
* @param $property
* @param $expression
* @returns
* <$property>: -moz-calc(<value>);
* <$property>: -webkit-calc(<value>);
* <$property>: calc(<value>);
*
* @example
* .selector {
* @include calc(width, '100% - 105px');
* }
*/
@mixin calc($property, $expression) {
#{$property}: -moz-calc(#{$expression});
#{$property}: -webkit-calc(#{$expression});
#{$property}: calc(#{$expression});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment