Skip to content

Instantly share code, notes, and snippets.

@fernandofuly
Created September 15, 2015 15:05
Show Gist options
  • Save fernandofuly/f461d819360cfa426699 to your computer and use it in GitHub Desktop.
Save fernandofuly/f461d819360cfa426699 to your computer and use it in GitHub Desktop.
Sass tips
// Placeholder
%btn {
padding: 10px;
color: #fff;
cursor: pointer;
border: none;
shadow: none;
font-size: 14px;
width: 150px;
margin: 5px 0;
text-align: center;
display: block;
text-decoration: none;
}
// Mixin
@mixin btn-background($btn-background) {
@extend %btn;
background-color: $btn-background;
&:hover {
background-color: lighten($btn-background, 10%);
}
}
// Usage
.btn-alert {
@include btn-background(green);
}
.btn-warning {
@include btn-background(red);
}
.btn-success {
@include btn-background(blue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment