vendor/toolkit/twitter/bootstrap/buttons.less in twitter-bootstrap-rails-2.0 vs vendor/toolkit/twitter/bootstrap/buttons.less in twitter-bootstrap-rails-2.0.0
- old
+ new
@@ -1,116 +1,165 @@
// BUTTON STYLES
// -------------
-// Shared colors for buttons and alerts
-.btn {
- // Set text color
- &.danger,
- &.danger:hover,
- &.success,
- &.success:hover,
- &.info,
- &.info:hover {
- text-shadow: 0 -1px 0 rgba(0,0,0,.25);
- color: @white
- }
- // Danger and error appear as red
- &.danger {
- .gradientBar(#ee5f5b, #c43c35);
- }
- // Success appears as green
- &.success {
- .gradientBar(#62c462, #57a957);
- }
- // Info appears as a neutral blue
- &.info {
- .gradientBar(#5bc0de, #339bb9);
- }
-}
-// Base .btn styles
+// Base styles
+// --------------------------------------------------
+
+// Core
.btn {
- // Button Base
display: inline-block;
- padding: 5px 10px 6px;
+ padding: 4px 10px 4px;
font-size: @baseFontSize;
- line-height: normal;
+ line-height: @baseLineHeight;
color: @grayDark;
+ text-align: center;
text-shadow: 0 1px 1px rgba(255,255,255,.75);
#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;
- &:hover {
- color: @grayDark;
- text-decoration: none;
- background-position: 0 -15px;
- }
+ // Give IE7 some love
+ .ie7-restore-left-whitespace();
+}
- // Focus state for keyboard and accessibility
- &:focus {
- outline: 1px dotted #666;
- }
+// Hover state
+.btn:hover {
+ color: @grayDark;
+ text-decoration: none;
+ background-color: darken(@white, 10%);
+ background-position: 0 -15px;
- // Primary Button Type
- &.primary {
- color: @white;
- text-shadow: 0 -1px 0 rgba(0,0,0,.25);
- .gradientBar(@blue, @blueDark)
- }
+ // 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);
+}
- // Transitions
- .transition(.1s linear all);
+// Focus state for keyboard and accessibility
+.btn:focus {
+ .tab-focus();
+}
- // Active and Disabled states
- &.active,
- &: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);
- }
- &.disabled {
- cursor: default;
- background-image: none;
- .reset-filter();
- .opacity(65);
- .box-shadow(none);
- }
- &[disabled] {
- // disabled pseudo can't be included with .disabled
- // def because IE8 and below will drop it ;_;
- cursor: default;
- background-image: none;
- .reset-filter();
- .opacity(65);
- .box-shadow(none);
- }
+// Active state
+.btn.active,
+.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;
+}
- // Button Sizes
- &.large {
- padding: 9px 14px 9px;
- font-size: @baseFontSize + 2px;
- line-height: normal;
- .border-radius(5px);
- }
- &.small {
- padding: 7px 9px 7px;
- font-size: @baseFontSize - 2px;
- }
+// Disabled state
+.btn.disabled,
+.btn[disabled] {
+ cursor: default;
+ background-image: none;
+ background-color: darken(@white, 10%);
+ .opacity(65);
+ .box-shadow(none);
}
-// Super jank hack for removing border-radius from IE9 so we can keep filter gradients on alerts and buttons
-:root .btn {
- border-radius: 0 \0;
+
+
+// Button Sizes
+// --------------------------------------------------
+
+// Large
+.btn-large {
+ padding: 9px 14px;
+ font-size: @baseFontSize + 2px;
+ line-height: normal;
+ .border-radius(5px);
}
+.btn-large .icon {
+ margin-top: 1px;
+}
-// Help Firefox not be a jerk about adding extra padding to buttons
+// Small
+.btn-small {
+ padding: 5px 9px;
+ font-size: @baseFontSize - 2px;
+ line-height: @baseLineHeight - 2px;
+}
+.btn-small .icon {
+ 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 {
+ text-shadow: 0 -1px 0 rgba(0,0,0,.25);
+ color: @white;
+}
+// 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 {
+ color: rgba(255,255,255,.75);
+}
+
+// Set the backgrounds
+// -------------------------
+.btn-primary {
+ .buttonBackground(@primaryButtonBackground, spin(@primaryButtonBackground, 20));
+}
+// Warning appears are orange
+.btn-warning {
+ .buttonBackground(lighten(@orange, 15%), @orange);
+}
+// Danger and error appear as red
+.btn-danger {
+ .buttonBackground(#ee5f5b, #bd362f);
+}
+// Success appears as green
+.btn-success {
+ .buttonBackground(#62c462, #51a351);
+}
+// Info appears as a neutral blue
+.btn-info {
+ .buttonBackground(#5bc0de, #2f96b4);
+}
+
+
+// Cross-browser Jank
+// --------------------------------------------------
+
button.btn,
-input[type=submit].btn {
+input[type="submit"].btn {
&::-moz-focus-inner {
- padding: 0;
- border: 0;
+ padding: 0;
+ border: 0;
}
-}
\ No newline at end of file
+
+ // 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;
+ }
+}