buttons.less 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. //
  2. // Buttons
  3. // --------------------------------------------------
  4. // Base styles
  5. // --------------------------------------------------
  6. // Core
  7. .btn {
  8. display: inline-block;
  9. .ie7-inline-block();
  10. font-weight: 400;
  11. padding: 0 8px;
  12. margin: 0;
  13. height: 29px;
  14. min-height: 29px;
  15. line-height: 1;
  16. vertical-align: bottom;
  17. // min-width: 46px;
  18. text-align: center;
  19. color: @grayDark;
  20. // font-size: 11px;
  21. font-weight: bold;
  22. font-size: @baseFontSize;
  23. text-align: center;
  24. vertical-align: middle;
  25. cursor: pointer;
  26. .buttonBackground(@btnBackground, @btnBackgroundHighlight, @grayDark, none);
  27. border: 1px solid @btnBorder;
  28. *border: 0; // Remove the border to prevent IE7's black border on input:focus
  29. // border-bottom-color: darken(@btnBorder, 10%);
  30. .border-radius(@baseBorderRadius);
  31. .ie7-restore-left-whitespace(); // Give IE7 some love
  32. .box-shadow(none);
  33. // Hover/focus state
  34. &:hover,
  35. &:focus {
  36. text-decoration: none;
  37. background-position: 0 -15px;
  38. // .buttonBackground(darken(@btnBackground, 0.6%), @btnBackgroundHighlight, @grayDark, none);
  39. .box-shadow(0 1px 1px rgba(0,0,0,.1));
  40. color: @grayDarken;
  41. // border-color: darken(@btnBorder, 0.6%);
  42. // transition is only when going to hover/focus, otherwise the background
  43. // behind the gradient (there for IE<=9 fallback) gets mismatched
  44. .transition(background-position .1s linear);
  45. }
  46. // Focus state for keyboard and accessibility
  47. &:focus {
  48. .tab-focus();
  49. }
  50. // Active state
  51. &.active,
  52. &:active {
  53. // background-image: none;
  54. border-color: darken(@btnBorder, 0.6%);
  55. // #gradient > .vertical(#fff,#f8f8f8);
  56. outline: 0;
  57. .box-shadow(0 1px 2px rgba(0, 0, 0, 0.1) inset);
  58. }
  59. // Disabled state
  60. &.disabled,
  61. &[disabled] {
  62. cursor: default;
  63. background-image: none;
  64. .opacity(65);
  65. .box-shadow(none);
  66. }
  67. }
  68. a.btn {
  69. line-height: 29px;
  70. }
  71. a.btn-mini {
  72. line-height: 19px;
  73. }
  74. // Button Sizes
  75. // --------------------------------------------------
  76. // Large
  77. .btn-large {
  78. height: 54px;
  79. min-height: 54px;
  80. padding: @paddingLarge;
  81. font-size: @fontSizeLarge;
  82. .border-radius(@borderRadiusLarge);
  83. }
  84. a.btn-large {
  85. height: 30px;
  86. min-height: 30px;
  87. line-height: 30px;
  88. }
  89. .btn-large [class^="icon-"],
  90. .btn-large [class*=" icon-"] {
  91. margin-top: 4px;
  92. }
  93. // Small
  94. .btn-small {
  95. padding: @paddingSmall;
  96. font-size: @fontSizeSmall;
  97. .border-radius(@borderRadiusSmall);
  98. }
  99. .btn-small [class^="icon-"],
  100. .btn-small [class*=" icon-"] {
  101. margin-top: 0;
  102. }
  103. .btn-mini [class^="icon-"],
  104. .btn-mini [class*=" icon-"] {
  105. margin-top: -1px;
  106. }
  107. // Mini
  108. .btn-mini {
  109. padding: @paddingMini;
  110. width: auto;
  111. min-width: 10px;
  112. height: 20px;
  113. min-height: 20px;
  114. font-size: @fontSizeMini;
  115. line-height: 20px;
  116. .border-radius(@borderRadiusSmall);
  117. }
  118. // Block button
  119. // -------------------------
  120. .btn-block {
  121. display: block;
  122. width: 100%;
  123. padding-left: 0;
  124. padding-right: 0;
  125. .box-sizing(border-box);
  126. }
  127. // Vertically space out multiple block buttons
  128. .btn-block + .btn-block {
  129. margin-top: 5px;
  130. }
  131. // Specificity overrides
  132. input[type="submit"],
  133. input[type="reset"],
  134. input[type="button"] {
  135. &.btn-block {
  136. width: 100%;
  137. }
  138. }
  139. // Alternate buttons
  140. // --------------------------------------------------
  141. // Provide *some* extra contrast for those who can get it
  142. .btn-primary.active,
  143. .btn-warning.active,
  144. .btn-danger.active,
  145. .btn-success.active,
  146. .btn-info.active,
  147. .btn-inverse.active {
  148. color: rgba(255,255,255,.75);
  149. }
  150. .btn-primary:hover,
  151. .btn-warning:hover,
  152. .btn-danger:hover,
  153. .btn-success:hover,
  154. .btn-info:hover,
  155. .btn-inverse:hover {
  156. color: @white;
  157. }
  158. // Set the backgrounds
  159. // -------------------------
  160. .btn-primary {
  161. .buttonBackground(@btnPrimaryBackground, @btnPrimaryBackgroundHighlight);
  162. // &:hover {
  163. // .buttonBackground(darken(@btnPrimaryBackground, 0.6%), @btnPrimaryBackgroundHighlight);
  164. // }
  165. }
  166. // Warning appears are orange
  167. .btn-warning {
  168. .buttonBackground(@btnWarningBackground, @btnWarningBackgroundHighlight);
  169. }
  170. // Danger and error appear as red
  171. .btn-danger {
  172. .buttonBackground(@btnDangerBackground, @btnDangerBackgroundHighlight);
  173. }
  174. // Success appears as green
  175. .btn-success {
  176. .buttonBackground(@btnSuccessBackground, @btnSuccessBackgroundHighlight);
  177. }
  178. // Info appears as a neutral blue
  179. .btn-info {
  180. .buttonBackground(@btnInfoBackground, @btnInfoBackgroundHighlight);
  181. }
  182. // Inverse appears as dark gray
  183. .btn-inverse {
  184. .buttonBackground(@btnInverseBackground, @btnInverseBackgroundHighlight);
  185. }
  186. // Cross-browser Jank
  187. // --------------------------------------------------
  188. button.btn,
  189. input[type="submit"].btn {
  190. // Firefox 3.6 only I believe
  191. &::-moz-focus-inner {
  192. padding: 0;
  193. border: 0;
  194. }
  195. // IE7 has some default padding on button controls
  196. *padding-top: 3px;
  197. *padding-bottom: 3px;
  198. &.btn-large {
  199. *padding-top: 7px;
  200. *padding-bottom: 7px;
  201. }
  202. &.btn-small {
  203. *padding-top: 3px;
  204. *padding-bottom: 3px;
  205. }
  206. &.btn-mini {
  207. *padding-top: 1px;
  208. *padding-bottom: 1px;
  209. }
  210. }
  211. // Link buttons
  212. // --------------------------------------------------
  213. // Make a button look and behave like a link
  214. .btn-link,
  215. .btn-link:active,
  216. .btn-link[disabled] {
  217. background-color: transparent;
  218. background-image: none;
  219. .box-shadow(none);
  220. }
  221. .btn-link {
  222. border-color: transparent;
  223. cursor: pointer;
  224. color: @linkColor;
  225. .border-radius(0);
  226. }
  227. .btn-link:hover,
  228. .btn-link:focus {
  229. color: @linkColorHover;
  230. text-decoration: underline;
  231. background-color: transparent;
  232. }
  233. .btn-link[disabled]:hover,
  234. .btn-link[disabled]:focus {
  235. color: @grayDark;
  236. text-decoration: none;
  237. }