1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00
twbs--bootstrap/less/buttons.less
Mark Otto bc0b94a3fd Merge branch 'master' into 3.0.0-wip
Conflicts:
	docs/assets/css/bootstrap.css
	docs/assets/js/bootstrap.js
	docs/css.html
	docs/templates/pages/base-css.mustache
	docs/templates/pages/components.mustache
	docs/templates/pages/javascript.mustache
	less/breadcrumbs.less
	less/tables.less
	less/tests/css-tests.html
2012-12-08 17:40:42 -08:00

196 lines
4.2 KiB
Text

//
// Buttons
// --------------------------------------------------
// Base styles
// --------------------------------------------------
// Core
.btn {
display: inline-block;
padding: 6px 12px;
margin-bottom: 0; // For input.btn
font-size: @font-size-base;
line-height: @line-height-base;
text-align: center;
vertical-align: middle;
cursor: pointer;
.buttonBackground(@btn-background, @btn-background-highlight, @grayDark, 0 1px 1px rgba(255,255,255,.75));
border: 1px solid @btn-border;
border-bottom-color: darken(@btn-border, 10%);
border-radius: @border-radius-base;
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
// Hover state
&:hover {
color: @grayDark;
text-decoration: none;
background-position: 0 -15px;
// transition is only when going to hover, otherwise the background
// behind the gradient (there for IE<=9 fallback) gets mismatched
.transition(background-position .1s linear);
}
// Focus state for keyboard and accessibility
&:focus {
.tab-focus();
}
// Active state
&.active,
&:active {
background-image: none;
outline: 0;
.box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)");
}
// Disabled state
&.disabled,
&[disabled] {
cursor: default;
background-image: none;
.opacity(65);
.box-shadow(none);
}
}
// Button Sizes
// -------------------------
// Large
.btn-large {
padding: @padding-large;
font-size: @font-size-large;
border-radius: @border-radius-large;
}
// Small
.btn-small {
padding: @padding-small;
font-size: @font-size-small;
border-radius: @border-radius-small;
}
.btn-mini [class^="icon-"],
.btn-mini [class*=" icon-"] {
margin-top: -1px;
}
// Mini
.btn-mini {
padding: @padding-mini;
font-size: @font-size-mini;
border-radius: @border-radius-small;
}
// Icons in buttons
// -------------------------
.btn [class^="glyphicon-"]::before { vertical-align: -2px; }
.btn-small [class^="glyphicon-"]::before,
.btn-mini [class^="glyphicon-"]::before { vertical-align: -1px; }
// Block button
// -------------------------
.btn-block {
display: block;
width: 100%;
padding-left: 0;
padding-right: 0;
.box-sizing(border-box);
}
// 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%;
}
}
// Alternate buttons
// --------------------------------------------------
// Provide *some* extra contrast for those who can get it
.btn-primary.active,
.btn-warning.active,
.btn-danger.active,
.btn-success.active,
.btn-info.active,
.btn-inverse.active {
color: rgba(255,255,255,.75);
}
// Set the backgrounds
// -------------------------
.btn {
// reset here as of 2.0.3 due to Recess property order
border-color: #c5c5c5;
border-color: rgba(0,0,0,.15) rgba(0,0,0,.15) rgba(0,0,0,.25);
}
.btn-primary {
.buttonBackground(@btn-backround-primary, @btn-backround-primary-highlight);
}
// Warning appears are orange
.btn-warning {
.buttonBackground(@btn-backround-warning, @btn-backround-warning-highlight);
}
// Danger and error appear as red
.btn-danger {
.buttonBackground(@btn-backround-danger, @btn-backround-danger-highlight);
}
// Success appears as green
.btn-success {
.buttonBackground(@btn-backround-success, @btn-backround-success-highlight);
}
// Info appears as a neutral blue
.btn-info {
.buttonBackground(@btn-backround-info, @btn-backround-info-highlight);
}
// Inverse appears as dark gray
.btn-inverse {
.buttonBackground(@btn-backround-inverse, @btn-backround-inverse-highlight);
}
// Link buttons
// --------------------------------------------------
// Make a button look and behave like a link
.btn-link,
.btn-link:active,
.btn-link[disabled] {
background-color: transparent;
background-image: none;
.box-shadow(none);
}
.btn-link {
border-color: transparent;
cursor: pointer;
color: @link-color;
border-radius: 0;
}
.btn-link:hover {
color: @link-color-hover;
text-decoration: underline;
background-color: transparent;
}
.btn-link[disabled]:hover {
color: @grayDark;
text-decoration: none;
}