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

197 lines
4.2 KiB
Text
Raw Normal View History

2012-06-29 00:46:45 -04:00
//
// Buttons
// --------------------------------------------------
// Base styles
2012-01-30 23:50:51 -05:00
// --------------------------------------------------
2012-01-30 23:50:51 -05:00
// 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;
2012-04-16 19:34:08 -04:00
cursor: pointer;
2012-11-30 18:05:23 -05:00
.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);
}
2012-01-30 23:50:51 -05:00
}
// Button Sizes
// -------------------------
2012-01-30 23:50:51 -05:00
// Large
.btn-large {
padding: @padding-large;
font-size: @font-size-large;
border-radius: @border-radius-large;
2012-01-30 23:50:51 -05:00
}
// Small
.btn-small {
padding: @padding-small;
font-size: @font-size-small;
border-radius: @border-radius-small;
2012-01-30 23:50:51 -05:00
}
.btn-mini [class^="icon-"],
.btn-mini [class*=" icon-"] {
margin-top: -1px;
}
2012-01-30 23:50:51 -05:00
2012-02-17 00:28:16 -05:00
// Mini
.btn-mini {
padding: @padding-mini;
font-size: @font-size-mini;
border-radius: @border-radius-small;
2012-02-17 00:28:16 -05:00
}
// 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
2012-07-29 03:30:15 -04:00
.btn-block + .btn-block {
margin-top: 5px;
}
// Specificity overrides
input[type="submit"],
input[type="reset"],
input[type="button"] {
&.btn-block {
width: 100%;
}
}
2012-01-30 23:50:51 -05:00
// Alternate buttons
// --------------------------------------------------
// Provide *some* extra contrast for those who can get it
.btn-primary.active,
.btn-warning.active,
.btn-danger.active,
.btn-success.active,
2012-02-09 17:08:14 -05:00
.btn-info.active,
2012-02-17 23:25:49 -05:00
.btn-inverse.active {
2012-01-30 23:50:51 -05:00
color: rgba(255,255,255,.75);
}
// Set the backgrounds
// -------------------------
.btn {
// reset here as of 2.0.3 due to Recess property order
2012-08-01 20:01:29 -04:00
border-color: #c5c5c5;
border-color: rgba(0,0,0,.15) rgba(0,0,0,.15) rgba(0,0,0,.25);
}
.btn-primary {
2012-11-30 18:05:23 -05:00
.buttonBackground(@btn-backround-primary, @btn-backround-primary-highlight);
}
2012-01-30 23:50:51 -05:00
// Warning appears are orange
.btn-warning {
2012-11-30 18:05:23 -05:00
.buttonBackground(@btn-backround-warning, @btn-backround-warning-highlight);
2012-01-30 23:50:51 -05:00
}
// Danger and error appear as red
.btn-danger {
2012-11-30 18:05:23 -05:00
.buttonBackground(@btn-backround-danger, @btn-backround-danger-highlight);
2012-01-30 23:50:51 -05:00
}
// Success appears as green
.btn-success {
2012-11-30 18:05:23 -05:00
.buttonBackground(@btn-backround-success, @btn-backround-success-highlight);
2012-01-30 23:50:51 -05:00
}
// Info appears as a neutral blue
.btn-info {
2012-11-30 18:05:23 -05:00
.buttonBackground(@btn-backround-info, @btn-backround-info-highlight);
2012-01-30 23:50:51 -05:00
}
// Inverse appears as dark gray
.btn-inverse {
2012-11-30 18:05:23 -05:00
.buttonBackground(@btn-backround-inverse, @btn-backround-inverse-highlight);
2012-02-09 17:08:14 -05:00
}
2012-01-30 23:50:51 -05:00
// Link buttons
// --------------------------------------------------
// Make a button look and behave like a link
.btn-link,
2012-08-31 17:02:18 -04:00
.btn-link:active,
.btn-link[disabled] {
background-color: transparent;
background-image: none;
.box-shadow(none);
}
.btn-link {
border-color: transparent;
cursor: pointer;
2012-11-30 17:37:24 -05:00
color: @link-color;
border-radius: 0;
}
.btn-link:hover {
2012-11-30 17:37:24 -05:00
color: @link-color-hover;
text-decoration: underline;
background-color: transparent;
}
2012-08-31 17:02:18 -04:00
.btn-link[disabled]:hover {
color: @grayDark;
text-decoration: none;
}