Skip to content

Instantly share code, notes, and snippets.

@manikrathee
Created August 13, 2013 04:57
Show Gist options
  • Save manikrathee/6218023 to your computer and use it in GitHub Desktop.
Save manikrathee/6218023 to your computer and use it in GitHub Desktop.
Extensive button arrangement in Sass
// ***************************
// $button
// ***************************
@mixin button($color) {
@extend %button_base;
color: lighten($color, 30%);
// background: darken($color, 4%);
// text-shadow: 0 1px 0darken($color, 25%);
border-color: darken(adjust-hue($color, -10), 30%);
@include transparent-gradient;
&:hover {
background: $color;
color: $white;
}
}
@mixin button_invert($color) {
@extend %button_base;
color: lighten($color, 30%);
background: darken($color, 4%);
text-shadow: 0 1px 0darken($color, 25%);
border-color: darken(adjust-hue($color, -10), 30%);
@include transparent-gradient;
&:hover {
background: $white;
color: $color;
}
}
%button_base, .button, button {
display: inline-block;
max-width: 100%;
padding: 10px 20px;
margin: 10px 0;
background: transparent;
border: 1px solid darken($divider-color, 10%);
color: darken($divider-color, 35%);
font-size: 11px;
font-weight: 500;
text-align: center;
text-transform: uppercase;
@include box;
@include radius(8px);
@include transition( (background 0.25s ease-in-out),(color 0.25s ease-in-out),(border 0.25s ease-in-out) );
&:hover {
background: $dark-blue;
color: $off-white;
border: 1px solid $light-blue;
}
}
.button_inverted {
background: $dark-blue;
border: 1px solid $light-blue;
color: $off-white;
&:hover{
background: transparent;
color: $dark-blue;
}
}
.button_cta {
font-size: 16px;
font-weight: 500;
padding: 20px 45px;
&:hover{
background: $green;
border: 1px solid $green;
}
}
.button_cta_inverted {
background: $green;
border: 1px solid $green;
color: $white;
&:hover{
background: transparent;
color: $green;
}
}
.button_invert_green, .button_invert_success {
@include button_invert($green);
}
.button_green, .button_success {
@include button($green);
}
.button_invert_red, .button_invert_error {
@include button_invert($red);
}
.button_red, .button_error {
@include button($red);
}
.button_invert_blue {
@include button_invert($dark-blue);
}
.button_blue {
@include button($dark-blue);
}
.button_invert_light-blue {
@include button_invert($light-blue);
}
.button_light-blue {
@include button($light-blue);
}
.button_invert_yellow, .button_invert_info {
@include button_invert($yellow);
}
.button_yellow, .button_info {
@include button($yellow);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment