Skip to content

Instantly share code, notes, and snippets.

@trub
Created April 8, 2014 20:34
Show Gist options
  • Select an option

  • Save trub/10187502 to your computer and use it in GitHub Desktop.

Select an option

Save trub/10187502 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
@import "bourbon/bourbon";
/*calculator*/
@mixin calc ($attr, $value, $tb-property: null, $percent: 100%, $operator: '-') {
@if $tb-property == 0 {
#{$attr}: 0 calc(#{$percent} #{$operator} #{$value});
} @else if $tb-property != 0 {
#{$attr}: calc(#{$percent} #{$operator} #{$value});
}
}
.block {
@include calc(width, em(50), $percent: '80%', $operator: '-');
}
.brick {
@include calc(margin, em(30), 0);
}
/*calculator*/
.block {
width: calc(80% - 3.125em); }
.brick {
margin: 0 calc(100% - 1.875em); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment