// // Buttons // -------------------------------------------------- // Base styles // -------------------------------------------------- %button { display: inline-block; margin-bottom: 0; // For input.btn padding: 9px 14px; font-size: 1.1rem; line-height: 1.428571429; font-weight: 300; text-align: center; text-transform: uppercase; text-shadow: none; letter-spacing: 1px; vertical-align: middle; cursor: pointer; background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 border: 1px solid transparent; white-space: nowrap; border-radius: $rounded; @include user-select(none); &, &:active, &.active { &:focus { @include tab-focus(); } } &:hover, &:focus { color: $blue; text-decoration: none; } &:active, &.active { outline: 0; background-image: none; box-shadow: inset 0 2px 2px rgba(0,0,0,.125); } &.disabled, &[disabled], fieldset[disabled] & { cursor: not-allowed; pointer-events: none; // Future-proof disabling of clicks opacity: 0.65; box-shadow: none; } } .btn { @extend %button; } // Alternate buttons // -------------------------------------------------- @mixin button-style($color, $background, $border) { color: $color; background-color: $background; border-color: $border; transition: background 0.2s ease, border-color 0.2s ease; &:hover, &:focus, &:active, &.active, .open > &.dropdown-toggle { color: $color; background-color: darken($background, 10%); border-color: darken($border, 12%); } &:active, &.active, .open > &.dropdown-toggle { background-image: none; } &.disabled, &[disabled], fieldset[disabled] & { &, &:hover, &:focus, &:active, &.active { background-color: $background; border-color: $border; } } .badge { color: $background; background-color: $color; box-shadow: 0 0 0 1px $color; } } .btn-default { font-weight: normal; @include button-style(#666, #fff, lighten($midgrey, 40%)); } .btn-alt { @include button-style(#fff, #A1ADB3, darken(#A1ADB3, 5%)); } .btn-blue { @include button-style(#fff, $blue, darken($blue, 5%)); } // Success appears as green .btn-green { @include button-style(#fff, $green, darken($green, 5%)); } // Danger and error appear as red .btn-red { @include button-style(#fff, $red, darken($red, 5%)); } // Link buttons // ------------------------- // Make a button look and behave like a link .btn-link { color: $blue; font-weight: normal; cursor: pointer; border-radius: 0; &, &:active, &[disabled], fieldset[disabled] & { background-color: transparent; box-shadow: none; } &, &:hover, &:focus, &:active { color: $blue; border-color: transparent; } &:hover, &:focus { text-decoration: underline; background-color: transparent; } &[disabled], fieldset[disabled] & { &:hover, &:focus { color: $midgrey; text-decoration: none; } } } // Minor buttons // ------------------------- // Add this class to buttons with a small/insignificant action // for example a "cancel" button. Style is de-emphasised. .btn-minor { text-transform: none; letter-spacing: 0; font-size: 1.2rem; padding: 8px 14px; } // Button Sizes // -------------------------------------------------- .btn-lg { padding: 12px 18px; font-size: 1.4rem; line-height: 1.33; border-radius: 4px; } .btn-sm { padding: 7px 10px; font-size: 1rem; line-height: 1.5; border-radius: 2px; } // Block button // -------------------------------------------------- .btn-block { display: block; width: 100%; } // Vertically space out multiple block buttons .btn-block + .btn-block { margin-top: 5px; } // Specificity overrides input[type="submit"], input[type="reset"], input[type="button"] { &.btn-block { width: 100%; } }