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

166 lines
3.4 KiB
Text
Raw Normal View History

// BUTTON STYLES
// -------------
// Base styles
2012-01-30 23:50:51 -05:00
// --------------------------------------------------
2012-01-30 23:50:51 -05:00
// Core
.btn {
display: inline-block;
padding: 4px 10px 4px;
font-size: @baseFontSize;
line-height: @baseLineHeight;
2012-01-21 18:24:06 -05:00
color: @grayDark;
text-align: center;
text-shadow: 0 1px 1px rgba(255,255,255,.75);
2012-01-21 18:24:06 -05:00
#gradient > .vertical-three-colors(@white, @white, 25%, darken(@white, 10%)); // Don't use .gradientbar() here since it does a three-color gradient
border: 1px solid #ccc;
border-bottom-color: #bbb;
.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-30 23:50:51 -05:00
// Give IE7 some love
.ie7-restore-left-whitespace();
2012-01-30 23:50:51 -05:00
}
2012-01-30 23:50:51 -05:00
// Hover state
.btn:hover {
color: @grayDark;
text-decoration: none;
background-color: darken(@white, 10%);
background-position: 0 -15px;
2012-01-30 23:50:51 -05: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-30 23:50:51 -05:00
// Focus state for keyboard and accessibility
.btn:focus {
.tab-focus();
}
2012-01-30 23:50:51 -05:00
// Active state
.btn.active,
2012-01-30 23:50:51 -05: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");
color: rgba(0,0,0,.5);
outline: 0;
}
2012-01-30 23:50:51 -05:00
// Disabled state
.btn.disabled,
2012-01-30 23:50:51 -05: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-30 23:50:51 -05:00
padding: 9px 14px;
font-size: @baseFontSize + 2px;
line-height: normal;
.border-radius(5px);
}
.btn-large .icon {
2012-01-30 23:50:51 -05:00
margin-top: 1px;
}
// Small
.btn-small {
2012-01-30 23:50:51 -05:00
padding: 5px 9px;
font-size: @baseFontSize - 2px;
line-height: @baseLineHeight - 2px;
}
.btn-small .icon {
2012-01-30 23:50:51 -05:00
margin-top: -1px;
}
// 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,
.btn-info:hover {
2012-01-30 23:50:51 -05:00
text-shadow: 0 -1px 0 rgba(0,0,0,.25);
2012-02-01 21:18:39 -05:00
color: @white;
2012-01-30 23:50:51 -05:00
}
// 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 {
2012-01-30 23:50:51 -05:00
color: rgba(255,255,255,.75);
}
// Set the backgrounds
// -------------------------
.btn-primary {
2012-01-30 23:50:51 -05:00
.buttonBackground(@primaryButtonBackground, spin(@primaryButtonBackground, 20));
}
2012-01-30 23:50:51 -05:00
// Warning appears are orange
.btn-warning {
2012-01-30 23:50:51 -05:00
.buttonBackground(lighten(@orange, 15%), @orange);
}
// Danger and error appear as red
.btn-danger {
2012-01-30 23:50:51 -05:00
.buttonBackground(#ee5f5b, #bd362f);
}
// Success appears as green
.btn-success {
2012-01-30 23:50:51 -05:00
.buttonBackground(#62c462, #51a351);
}
// Info appears as a neutral blue
.btn-info {
2012-01-30 23:50:51 -05:00
.buttonBackground(#5bc0de, #2f96b4);
}
// Cross-browser Jank
// --------------------------------------------------
button.btn,
input[type="submit"].btn {
&::-moz-focus-inner {
2012-01-30 23:50:51 -05:00
padding: 0;
border: 0;
}
// IE7 has some default padding on button controls
*padding-top: 2px;
*padding-bottom: 2px;
&.large {
*padding-top: 7px;
*padding-bottom: 7px;
}
&.small {
*padding-top: 3px;
*padding-bottom: 3px;
}
}