0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-30 12:24:19 +01:00
Bootstrap/less/buttons.less

183 lines
3.8 KiB
Plaintext
Raw Normal View History

// BUTTON STYLES
// -------------
// Base styles
2012-01-31 05:50:51 +01:00
// --------------------------------------------------
2012-01-31 05:50:51 +01:00
// Core
.btn {
display: inline-block;
padding: 4px 10px 4px;
margin-bottom: 0; // For input.btn
font-size: @baseFontSize;
line-height: @baseLineHeight;
2012-01-22 00:24:06 +01:00
color: @grayDark;
text-align: center;
text-shadow: 0 1px 1px rgba(255,255,255,.75);
vertical-align: middle;
.buttonBackground(@btnBackground, @btnBackgroundHighlight);
border: 1px solid @btnBorder;
border-bottom-color: darken(@btnBorder, 10%);
.border-radius(4px);
@shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05);
.box-shadow(@shadow);
cursor: pointer;
2012-01-31 05:50:51 +01:00
// Give IE7 some love
.ie7-restore-left-whitespace();
2012-01-31 05:50:51 +01:00
}
2012-01-31 05:50:51 +01:00
// Hover state
.btn:hover {
color: @grayDark;
text-decoration: none;
background-color: darken(@white, 10%);
background-position: 0 -15px;
2012-01-31 05:50:51 +01:00
// 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);
}
2012-01-31 05:50:51 +01:00
// Focus state for keyboard and accessibility
.btn:focus {
.tab-focus();
}
2012-01-31 05:50:51 +01:00
// Active state
.btn.active,
2012-01-31 05:50:51 +01:00
.btn:active {
background-image: none;
@shadow: inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05);
.box-shadow(@shadow);
background-color: darken(@white, 10%);
background-color: darken(@white, 15%) e("\9");
outline: 0;
}
2012-01-31 05:50:51 +01:00
// Disabled state
.btn.disabled,
2012-01-31 05:50:51 +01:00
.btn[disabled] {
cursor: default;
background-image: none;
background-color: darken(@white, 10%);
.opacity(65);
.box-shadow(none);
}
// Button Sizes
// --------------------------------------------------
// Large
.btn-large {
2012-01-31 05:50:51 +01:00
padding: 9px 14px;
font-size: @baseFontSize + 2px;
line-height: normal;
.border-radius(5px);
}
.btn-large [class^="icon-"] {
2012-01-31 05:50:51 +01:00
margin-top: 1px;
}
// Small
.btn-small {
2012-01-31 05:50:51 +01:00
padding: 5px 9px;
font-size: @baseFontSize - 2px;
line-height: @baseLineHeight - 2px;
}
.btn-small [class^="icon-"] {
2012-01-31 05:50:51 +01:00
margin-top: -1px;
}
2012-02-17 06:28:16 +01:00
// Mini
.btn-mini {
padding: 2px 6px;
font-size: @baseFontSize - 2px;
line-height: @baseLineHeight - 4px;
}
2012-01-31 05:50:51 +01:00
// Alternate buttons
// --------------------------------------------------
// Set text color
// -------------------------
.btn-primary,
.btn-primary:hover,
.btn-warning,
.btn-warning:hover,
.btn-danger,
.btn-danger:hover,
.btn-success,
.btn-success:hover,
.btn-info,
2012-02-09 23:08:14 +01:00
.btn-info:hover,
.btn-inverse,
.btn-inverse:hover {
2012-01-31 05:50:51 +01:00
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
2012-02-02 03:18:39 +01:00
color: @white;
2012-01-31 05:50:51 +01:00
}
// 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 23:08:14 +01:00
.btn-info.active,
2012-02-18 05:25:49 +01:00
.btn-inverse.active {
2012-01-31 05:50:51 +01:00
color: rgba(255,255,255,.75);
}
// Set the backgrounds
// -------------------------
.btn-primary {
.buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
}
2012-01-31 05:50:51 +01:00
// Warning appears are orange
.btn-warning {
.buttonBackground(@btnWarningBackground, @btnWarningBackgroundHighlight);
2012-01-31 05:50:51 +01:00
}
// Danger and error appear as red
.btn-danger {
.buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight);
2012-01-31 05:50:51 +01:00
}
// Success appears as green
.btn-success {
.buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight);
2012-01-31 05:50:51 +01:00
}
// Info appears as a neutral blue
.btn-info {
.buttonBackground(@btnInfoBackground, @btnInfoBackgroundHighlight);
2012-01-31 05:50:51 +01:00
}
// Inverse appears as dark gray
.btn-inverse {
.buttonBackground(@btnInverseBackground, @btnInverseBackgroundHighlight);
2012-02-09 23:08:14 +01:00
}
2012-01-31 05:50:51 +01:00
// Cross-browser Jank
// --------------------------------------------------
button.btn,
input[type="submit"].btn {
2012-02-12 22:20:08 +01:00
// Firefox 3.6 only I believe
&::-moz-focus-inner {
padding: 0;
2012-01-31 05:50:51 +01:00
border: 0;
}
// IE7 has some default padding on button controls
*padding-top: 2px;
*padding-bottom: 2px;
&.btn-large {
*padding-top: 7px;
*padding-bottom: 7px;
}
&.btn-small {
*padding-top: 3px;
*padding-bottom: 3px;
}
}