aboutsummaryrefslogtreecommitdiff
path: root/less/buttons.less
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-01-26 21:48:46 -0800
committerJacob Thornton <[email protected]>2012-01-26 21:48:46 -0800
commitdc2deb9a1b1995bbabee91bfd579d9b466fe78f2 (patch)
tree9606da7326fd0a1e2ba1727e7390a69555bd92c3 /less/buttons.less
parente0e54d9c6cb39eae53e31117c38ceae0a08a6e0b (diff)
downloadbootstrap-dc2deb9a1b1995bbabee91bfd579d9b466fe78f2.tar.xz
bootstrap-dc2deb9a1b1995bbabee91bfd579d9b466fe78f2.zip
moving structure around + more work on builder...
Diffstat (limited to 'less/buttons.less')
-rw-r--r--less/buttons.less151
1 files changed, 151 insertions, 0 deletions
diff --git a/less/buttons.less b/less/buttons.less
new file mode 100644
index 000000000..d7f533783
--- /dev/null
+++ b/less/buttons.less
@@ -0,0 +1,151 @@
+// BUTTON STYLES
+// -------------
+
+
+// Colors
+// ------
+
+.btn {
+ // Set text color
+ &.primary,
+ &.primary:hover,
+ &.danger,
+ &.danger:hover,
+ &.success,
+ &.success:hover,
+ &.info,
+ &.info:hover {
+ text-shadow: 0 -1px 0 rgba(0,0,0,.25);
+ color: @white
+ }
+ &.primary {
+ .buttonBackground(@primaryButtonBackground, spin(@primaryButtonBackground, 15));
+ }
+ // Danger and error appear as red
+ &.danger {
+ .buttonBackground(#ee5f5b, #c43c35);
+ }
+ // Success appears as green
+ &.success {
+ .buttonBackground(#62c462, #57a957);
+ }
+ // Info appears as a neutral blue
+ &.info {
+ .buttonBackground(#5bc0de, #339bb9);
+ }
+}
+
+
+// Mixin for generating button backgrounds
+// ---------------------------------------
+.buttonBackground(@startColor, @endColor) {
+ // gradientBar will set the background to a pleasing blend of these, to support IE<=9
+ .gradientBar(@startColor, @endColor);
+
+ // in these cases the gradient won't cover the background, so we override
+ &:hover, &:active, &.active, &.disabled {
+ background-color: @endColor;
+ }
+
+ // called out separately because IE8 would ignore otherwise
+ &[disabled] {
+ background-color: @endColor;
+ }
+
+ // IE 7 + 8 can't handle box-shadow to show active, so we darken a bit ourselves
+ &:active,
+ &.active {
+ background-color: darken(@endColor, 10%) e("\9");
+ }
+}
+
+
+// Base styles
+// -----------
+
+.btn {
+ // Button Base
+ display: inline-block;
+ padding: 4px 10px 4px;
+ font-size: @baseFontSize;
+ line-height: @baseLineHeight;
+ color: @grayDark;
+ 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-color: darken(@white, 10%);
+ 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 {
+ outline: 1px dotted #666;
+ }
+
+ // 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);
+ background-color: darken(@white, 10%);
+ background-color: darken(@white, 15%) e("\9");
+ }
+ &.disabled {
+ cursor: default;
+ background-image: none;
+ background-color: darken(@white, 10%);
+ .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;
+ background-color: darken(@white, 10%);
+ .opacity(65);
+ .box-shadow(none);
+ }
+
+ // Button Sizes
+ &.large {
+ padding: 9px 14px 9px;
+ font-size: @baseFontSize + 2px;
+ line-height: normal;
+ .border-radius(5px);
+ }
+ &.large .icon {
+ margin-top: 1px;
+ }
+ &.small {
+ padding: 5px 9px 5px;
+ font-size: @baseFontSize - 2px;
+ line-height: @baseLineHeight - 2px;
+ }
+ &.small .icon {
+ margin-top: -2px;
+ }
+}
+
+// Help Firefox not be a jerk about adding extra padding to buttons
+button.btn,
+input[type=submit].btn {
+ &::-moz-focus-inner {
+ padding: 0;
+ border: 0;
+ }
+}