No Description

buttons.less 3.6KB

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