0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Bootstrap/scss/_buttons.scss
Patrick Yeo dd0ce3e4b2 Rename variable $input-border-focus to $input-border-color-focus (#22413)
* Rename variable $input-border-focus to $input-border-color-focus
* Rename variables $pagination-hover-border, $pagination-active-border, $pagination-disabled-border to $pagination-hover-border-color, $pagination-active-border-color, $pagination-disabled-border-color, respectively
* Rename variables $state-*-border to $state-*-border-color, respectively
* Rename variables $alert-*-border to $alert-*-border-color
* Rename $list-group-active-border to $list-group-active-border-color
* Rename $table-inverse-border to $table-inverse-border-color
* Rename $btn-*-border to $btn-*-border-color
* Rename $navbar-*-toggler-border to $navbar-*-toggler-border-color
2017-04-16 15:45:10 -07:00

168 lines
3.5 KiB
SCSS

// scss-lint:disable QualifyingElement
//
// Base styles
//
.btn {
display: inline-block;
font-weight: $btn-font-weight;
text-align: center;
white-space: nowrap;
vertical-align: middle;
user-select: none;
border: $input-btn-border-width solid transparent;
@include button-size($input-btn-padding-y, $input-btn-padding-x, $font-size-base, $input-btn-line-height, $btn-border-radius);
@include transition($btn-transition);
// Share hover and focus styles
@include hover-focus {
text-decoration: none;
}
&:focus,
&.focus {
outline: 0;
box-shadow: $btn-focus-box-shadow;
}
// Disabled comes first so active can properly restyle
&.disabled,
&:disabled {
opacity: .65;
@include box-shadow(none);
}
&:active,
&.active {
background-image: none;
@include box-shadow($btn-focus-box-shadow, $btn-active-box-shadow);
}
}
// Future-proof disabling of clicks on `<a>` elements
a.btn.disabled,
fieldset[disabled] a.btn {
pointer-events: none;
}
//
// Alternate buttons
//
.btn-primary {
@include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border-color);
}
.btn-secondary {
@include button-variant($btn-secondary-color, $btn-secondary-bg, $btn-secondary-border-color);
}
.btn-info {
@include button-variant($btn-info-color, $btn-info-bg, $btn-info-border-color);
}
.btn-success {
@include button-variant($btn-success-color, $btn-success-bg, $btn-success-border-color);
}
.btn-warning {
@include button-variant($btn-warning-color, $btn-warning-bg, $btn-warning-border-color);
}
.btn-danger {
@include button-variant($btn-danger-color, $btn-danger-bg, $btn-danger-border-color);
}
// Remove all backgrounds
.btn-outline-primary {
@include button-outline-variant($btn-primary-bg, $btn-primary-color);
}
.btn-outline-secondary {
@include button-outline-variant($btn-secondary-border-color, $btn-secondary-color);
}
.btn-outline-info {
@include button-outline-variant($btn-info-bg, $btn-info-color);
}
.btn-outline-success {
@include button-outline-variant($btn-success-bg, $btn-success-color);
}
.btn-outline-warning {
@include button-outline-variant($btn-warning-bg, $btn-warning-color);
}
.btn-outline-danger {
@include button-outline-variant($btn-danger-bg, $btn-danger-color);
}
//
// Link buttons
//
// Make a button look and behave like a link
.btn-link {
font-weight: $font-weight-normal;
color: $link-color;
border-radius: 0;
&,
&:active,
&.active,
&:disabled {
background-color: transparent;
@include box-shadow(none);
}
&,
&:focus,
&:active {
border-color: transparent;
}
@include hover {
border-color: transparent;
}
@include hover-focus {
color: $link-hover-color;
text-decoration: $link-hover-decoration;
background-color: transparent;
}
&:disabled {
color: $btn-link-disabled-color;
@include hover-focus {
text-decoration: none;
}
}
}
//
// Button Sizes
//
.btn-lg {
@include button-size($input-btn-padding-y-lg, $input-btn-padding-x-lg, $font-size-lg, $line-height-lg, $btn-border-radius-lg);
}
.btn-sm {
@include button-size($input-btn-padding-y-sm, $input-btn-padding-x-sm, $font-size-sm, $line-height-sm, $btn-border-radius-sm);
}
//
// Block button
//
.btn-block {
display: block;
width: 100%;
}
// Vertically space out multiple block buttons
.btn-block + .btn-block {
margin-top: $btn-block-spacing-y;
}
// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
&.btn-block {
width: 100%;
}
}