Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sass 101 - A newb's guide: mixins w/default arguments

Mixins can also specify default values for their arguments using the normal variable-setting syntax. Then when the mixin is included, if it doesn’t pass in that argument, the default value will be used instead. For example:

mixins_w_default_arguments.scss

SassMeister Gist

@mixin border($radius: 3px, $style: 1px solid red) {
-moz-border-radius: $radius;
-webkit-border-radius: $radius;
border-radius: $radius;
border: $style;
}
.my-new-class {
@include border;
}
.my-other-class {
@include border(3px 3px 0 0, 1px solid orange);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment