Skip to content

Instantly share code, notes, and snippets.

@Ollo
Created August 15, 2013 17:37
Show Gist options
  • Save Ollo/6242863 to your computer and use it in GitHub Desktop.
Save Ollo/6242863 to your computer and use it in GitHub Desktop.
mixin that takes advantage of @extend for modularity. src: http://blog.teamtreehouse.com/extending-placeholder-selectors-with-sass
// base button styles
%btn {
padding: em(14) em(40);
color: $white;
display: inline-block;
@include border-radius(7px);
&:hover {
color: $white;
}
}
// gradient background style
@mixin btn-theme($startColor, $stopColor) {
@extend %btn;
@include background-image(linear-gradient($startColor 0, $stopColor 75%));
}
// themes
%blue {
@include btn-theme(#00aeff, $blue);
}
// actual buttons with semantic names
.btn-primary {
@extend %blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment