Joined July 2013
·

Shawn Christenson

Alberta, Canada
·
·

Posted to SASS CSS3 calc mixin over 1 year ago

Thanks for this. I added something to include a default, for those unsupported like Opera, also:

@mixin calc($property, $default, $expression) {
#{$property}: $default;
#{$property}: -webkit-calc(#{$expression});
#{$property}: -moz-calc(#{$expression});
#{$property}: calc(#{$expression});
}

And a little extra info - in order o have the expression include a $var, I did this:
@include calc(width, 98%, "100% - #{$border-width*2}");

Achievements
1 Karma
0 Total ProTip Views