You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
3.5 KiB

  1. //
  2. // Buttons
  3. // --------------------------------------------------
  4. // Base styles
  5. // --------------------------------------------------
  6. .btn {
  7. display: inline-block;
  8. margin-bottom: 0; // For input.btn
  9. font-weight: @btn-font-weight;
  10. text-align: center;
  11. vertical-align: middle;
  12. cursor: pointer;
  13. background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
  14. border: 1px solid transparent;
  15. white-space: nowrap;
  16. .button-size(@padding-base-vertical; @padding-base-horizontal; @font-size-base; @line-height-base; @border-radius-base);
  17. .user-select(none);
  18. &,
  19. &:active,
  20. &.active {
  21. &:focus {
  22. .tab-focus();
  23. }
  24. }
  25. &:hover,
  26. &:focus {
  27. color: @btn-default-color;
  28. text-decoration: none;
  29. }
  30. &:active,
  31. &.active {
  32. outline: 0;
  33. background-image: none;
  34. .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
  35. }
  36. &.disabled,
  37. &[disabled],
  38. fieldset[disabled] & {
  39. cursor: not-allowed;
  40. pointer-events: none; // Future-proof disabling of clicks
  41. .opacity(.65);
  42. .box-shadow(none);
  43. }
  44. }
  45. // Alternate buttons
  46. // --------------------------------------------------
  47. .btn-default {
  48. .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
  49. }
  50. .btn-primary {
  51. .button-variant(@btn-primary-color; @btn-primary-bg; @btn-primary-border);
  52. }
  53. // Success appears as green
  54. .btn-success {
  55. .button-variant(@btn-success-color; @btn-success-bg; @btn-success-border);
  56. }
  57. // Info appears as blue-green
  58. .btn-info {
  59. .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);
  60. }
  61. // Warning appears as orange
  62. .btn-warning {
  63. .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);
  64. }
  65. // Danger and error appear as red
  66. .btn-danger {
  67. .button-variant(@btn-danger-color; @btn-danger-bg; @btn-danger-border);
  68. }
  69. // Link buttons
  70. // -------------------------
  71. // Make a button look and behave like a link
  72. .btn-link {
  73. color: @link-color;
  74. font-weight: normal;
  75. cursor: pointer;
  76. border-radius: 0;
  77. &,
  78. &:active,
  79. &[disabled],
  80. fieldset[disabled] & {
  81. background-color: transparent;
  82. .box-shadow(none);
  83. }
  84. &,
  85. &:hover,
  86. &:focus,
  87. &:active {
  88. border-color: transparent;
  89. }
  90. &:hover,
  91. &:focus {
  92. color: @link-hover-color;
  93. text-decoration: underline;
  94. background-color: transparent;
  95. }
  96. &[disabled],
  97. fieldset[disabled] & {
  98. &:hover,
  99. &:focus {
  100. color: @btn-link-disabled-color;
  101. text-decoration: none;
  102. }
  103. }
  104. }
  105. // Button Sizes
  106. // --------------------------------------------------
  107. .btn-lg {
  108. // line-height: ensure even-numbered height of button next to large input
  109. .button-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
  110. }
  111. .btn-sm {
  112. // line-height: ensure proper height of button next to small input
  113. .button-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
  114. }
  115. .btn-xs {
  116. .button-size(@padding-xs-vertical; @padding-xs-horizontal; @font-size-small; @line-height-small; @border-radius-small);
  117. }
  118. // Block button
  119. // --------------------------------------------------
  120. .btn-block {
  121. display: block;
  122. width: 100%;
  123. padding-left: 0;
  124. padding-right: 0;
  125. }
  126. // Vertically space out multiple block buttons
  127. .btn-block + .btn-block {
  128. margin-top: 5px;
  129. }
  130. // Specificity overrides
  131. input[type="submit"],
  132. input[type="reset"],
  133. input[type="button"] {
  134. &.btn-block {
  135. width: 100%;
  136. }
  137. }