buttons.less 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. //buttons
  2. .btn {
  3. display: inline-block;
  4. color: #FFF !important;
  5. text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25) !important;
  6. background-image: none !important;
  7. border: 5px solid #FFF;
  8. border-radius: 0;
  9. box-shadow: none !important;
  10. .transition(~"background-color 0.15s, border-color 0.15s, opacity 0.15s");
  11. cursor: pointer;
  12. vertical-align: middle;
  13. margin: 0;
  14. position: relative;
  15. }
  16. .btn-lg {
  17. border-width: 5px;
  18. line-height: 1.35;
  19. padding: 7px 16px;
  20. }
  21. .btn-sm {
  22. border-width: 4px;
  23. font-size: @font-size-btn-sm;
  24. padding: 4px 9px;
  25. line-height: 1.39;
  26. }
  27. .btn-xs {
  28. border-width: 3px;
  29. }
  30. .btn-minier {
  31. padding: 0 4px;
  32. line-height: 18px;
  33. border-width: 2px;
  34. font-size: @font-size-btn-minier;
  35. }
  36. button.btn:active {
  37. top: 1px;
  38. //left: 1px;
  39. //using both left & top, will cause chrome not to catch click events at seldom times
  40. }
  41. .enable_default_buttons() when(@enable-default-buttons = true) {
  42. //button color
  43. .btn-color(@color1, @color2) {
  44. & , &:focus {
  45. background-color:@color1 !important;
  46. border-color:@color1;
  47. }
  48. &:hover , &:active, .open &.dropdown-toggle {
  49. background-color:@color2 !important;
  50. border-color:@color1;
  51. }
  52. &.no-border:hover , &.no-border:active {
  53. border-color:@color2;
  54. }
  55. &.no-hover:hover , &.no-hover:active {
  56. background-color:@color1 !important;
  57. }
  58. &.active {
  59. background-color: mix(@color1,@color2) !important;
  60. border-color: darken(mix(@color1,@color2),7%);
  61. }
  62. &.no-border.active {
  63. background-color: darken(mix(@color1,@color2),3%) !important;
  64. border-color: darken(mix(@color1,@color2),3%);
  65. }
  66. &.disabled, &[disabled], fieldset[disabled] & {
  67. &,
  68. &:hover,
  69. &:focus,
  70. &:active,
  71. &.active {
  72. background-color:@color1 !important;
  73. border-color:@color1;
  74. }
  75. }
  76. }
  77. .btn-color(@color-name) {
  78. @color1-name : ~`"btn-@{color-name}"`;
  79. @color2-name : ~`"btn-@{color-name}-hover"`;
  80. .btn-color(@@color1-name, @@color2-name);
  81. }
  82. .btn , .btn-default {
  83. .btn-color(~"default");
  84. }
  85. .btn-primary {
  86. .btn-color(~"primary");
  87. }
  88. .btn-info {
  89. .btn-color(~"info");
  90. }
  91. .btn-info2 {
  92. .btn-color(~"info2");
  93. }
  94. .btn-success {
  95. .btn-color(~"success");
  96. }
  97. .btn-warning {
  98. .btn-color(~"warning");
  99. }
  100. .btn-danger {
  101. .btn-color(~"danger");
  102. }
  103. .btn-inverse {
  104. .btn-color(~"inverse");
  105. }
  106. .btn-pink {
  107. .btn-color(~"pink");
  108. }
  109. .btn-purple {
  110. .btn-color(~"purple");
  111. }
  112. .btn-grey {
  113. .btn-color(~"grey");
  114. }
  115. .btn-yellow {
  116. .btn-color(~"yellow");
  117. color:@btn-yellow-color !important;
  118. text-shadow:0 -1px 0 rgba(255, 255, 255, 0.4) !important;
  119. }
  120. .btn-light {
  121. .btn-color(~"light");
  122. color:@btn-light-color !important;
  123. text-shadow:0 -1px 0 rgba(250, 250, 250, 0.25) !important;
  124. &.btn-xs:after {
  125. left: -2px;
  126. right: -2px;
  127. top: -2px;
  128. bottom: -2px;
  129. }
  130. &.btn-sm:after {
  131. left: -4px;
  132. right: -4px;
  133. top: -4px;
  134. bottom: -4px;
  135. }
  136. .btn-lg:after {
  137. left: -6px;
  138. right: -6px;
  139. top: -6px;
  140. bottom: -6px;
  141. }
  142. }
  143. }
  144. .enable_default_buttons();
  145. .enable_white_buttons() when(@enable-white-buttons = true) {
  146. .btn.btn-white {
  147. //border-width: 1px;
  148. text-shadow: none !important;
  149. background-color: #FFF !important;
  150. &.no-hover:hover , &.no-hover:active {
  151. background-color: #FFF !important;
  152. }
  153. &:focus , &.active {
  154. box-shadow: inset 1px 1px 2px 0 rgba(0,0,0,0.1) !important;
  155. &.btn-bold {
  156. box-shadow: inset 1px 1px 3px 0 rgba(0,0,0,0.15) !important;
  157. }
  158. }
  159. &.active:after {
  160. display: none;
  161. }
  162. }
  163. .btn-white(@txt-color, @border-color, @bg-hover-color) {
  164. border-color: @border-color;
  165. color: @txt-color !important;
  166. &:hover, &:focus , &.active, &:active, .open &.dropdown-toggle {
  167. background-color: @bg-hover-color !important;
  168. border-color: @border-color;
  169. }
  170. &:hover {
  171. color: saturate(darken(@txt-color , 5%) , 5%) !important;
  172. }
  173. &.no-border:hover , &.no-border:active {
  174. border-color: @border-color;
  175. }
  176. &.disabled, &[disabled], fieldset[disabled] & {
  177. &,
  178. &:hover,
  179. &:focus,
  180. &:active,
  181. &.active {
  182. //background-color: #FFF !important;
  183. border-color: @border-color;
  184. }
  185. }
  186. }
  187. .btn.btn-white {
  188. .btn-white(#444, #CCC , #EBEBEB);
  189. }
  190. .btn-white.btn-default {
  191. .btn-white(darken(@btn-default-hover, 4%), @btn-default , lighten(@btn-default, 23%));
  192. }
  193. .btn-white.btn-primary {
  194. .btn-white(desaturate(@btn-primary , 30%), desaturate(lighten(@btn-primary , 15%), 15%) , desaturate(lighten(@btn-primary , 42%), 6%));
  195. }
  196. .btn-white.btn-success {
  197. .btn-white(desaturate(darken(@btn-success , 4%) , 8%), desaturate(lighten(@btn-success , 10%), 2%) , desaturate(lighten(@btn-success , 33%), 1%));
  198. }
  199. .btn-white.btn-danger {
  200. .btn-white(desaturate(lighten(@btn-danger, 5%) , 30%), desaturate(lighten(@btn-danger , 18%), 18%) , desaturate(lighten(@btn-danger , 42%), 7%));
  201. }
  202. .btn-white.btn-warning {
  203. .btn-white(desaturate(darken(@btn-warning , 6%), 36%), desaturate(lighten(@btn-warning , 3%), 30%) , desaturate(lighten(@btn-warning , 30%), 10%));
  204. }
  205. .btn-white.btn-info {
  206. .btn-white(desaturate(darken(@btn-info, 6%) , 25%), desaturate(lighten(@btn-info , 5%), 15%) , desaturate(lighten(@btn-info , 30%), 6%));
  207. }
  208. .btn-white.btn-inverse {
  209. .btn-white(@btn-inverse, lighten(@btn-inverse , 25%) , lighten(@btn-inverse , 56%));
  210. }
  211. .btn-white.btn-pink {
  212. .btn-white(desaturate(@btn-pink , 35%), desaturate(lighten(@btn-pink , 15%), 25%) , desaturate(lighten(@btn-pink , 40%), 5%));
  213. }
  214. .btn-white.btn-purple {
  215. .btn-white(darken(desaturate(@btn-purple , 10%) , 10%), desaturate(lighten(@btn-purple , 10%), 15%) , desaturate(lighten(@btn-purple , 31%), 5%));
  216. }
  217. .btn-white.btn-yellow {
  218. .btn-white(darken(desaturate(@btn-yellow , 20%) , 30%), desaturate(darken(@btn-yellow, 5%), 25%) , desaturate(lighten(@btn-yellow , 18%), 10%));
  219. }
  220. .btn-white.btn-grey {
  221. .btn-white(darken(@btn-grey , 8%), lighten(@btn-grey , 15%) , lighten(@btn-grey , 30%));
  222. }
  223. }
  224. .enable_white_buttons();
  225. .btn.disabled, .btn[disabled] {
  226. &.active, &:focus, &:active {
  227. outline:none;
  228. }
  229. &:active {
  230. top:0; left:0;
  231. }
  232. }
  233. //active buttons
  234. .btn.active {
  235. color:@btn-active-color;
  236. &:after {
  237. display: inline-block;
  238. content: "";
  239. position: absolute;
  240. border-bottom: 1px solid @btn-active-color;
  241. left: -4px;
  242. right: -4px;
  243. bottom: -4px;
  244. }
  245. &.btn-sm:after {
  246. left: -3px;
  247. right: -3px;
  248. bottom: -3px;
  249. //border-bottom-width:1px;
  250. }
  251. &.btn-lg:after {
  252. left: -5px;
  253. right: -5px;
  254. bottom: -5px;
  255. //border-bottom-width:1px;
  256. }
  257. &.btn-xs:after , &.btn-minier:after {
  258. left: -1px;
  259. right: -1px;
  260. bottom: -2px;
  261. //border-bottom-width:1px;
  262. }
  263. &.btn-minier:after {
  264. bottom: -1px;
  265. }
  266. &.btn-yellow:after {
  267. border-bottom-color: @btn-yellow-active-border;
  268. }
  269. &.btn-light {
  270. color: #515151;
  271. &:after {
  272. border-bottom-color: #B5B5B5;
  273. }
  274. }
  275. }
  276. //icons inside buttons
  277. .btn {
  278. > .@{icon} {
  279. margin-right: 4px;
  280. //min-width: 12px;
  281. //display: inline;
  282. &.icon-on-right {
  283. margin-right: 0;
  284. margin-left: 4px;
  285. }
  286. }
  287. > .icon-only.@{icon} {
  288. margin: 0 !important;//to override .rtl
  289. text-align: center;
  290. padding: 0;
  291. //min-width: 24px;
  292. //vertical-align: middle;
  293. }
  294. }
  295. .btn-large > .@{icon} {
  296. margin-right: 6px;
  297. &.icon-on-right {
  298. margin-right: 0;
  299. margin-left: 6px;
  300. }
  301. }
  302. .btn-sm > .@{icon} {
  303. margin-right: 3px;
  304. &.icon-on-right {
  305. margin-right: 0;
  306. margin-left: 3px;
  307. }
  308. }
  309. .btn-xs > .@{icon} , .btn-minier > .@{icon} {
  310. margin-right: 2px;
  311. &.icon-on-right {
  312. margin-right: 0;
  313. margin-left: 2px;
  314. }
  315. }
  316. .btn.btn-link {
  317. border: none !important;
  318. background: transparent none !important;
  319. color: @btn-link-color !important;
  320. text-shadow: none !important;
  321. padding: 4px 12px !important;
  322. line-height: 20px !important;
  323. &:hover {
  324. background: none !important;
  325. text-shadow: none !important;
  326. }
  327. &.active {
  328. background: none !important;
  329. text-decoration: underline;
  330. color: lighten(@btn-link-color , 6%) !important;
  331. &:after {
  332. display: none;
  333. }
  334. }
  335. &.disabled , &[disabled]{
  336. background: transparent none !important;
  337. .opacity(0.65);
  338. text-decoration: none !important;
  339. }
  340. }
  341. .btn.btn-no-border {
  342. border-width: 0 !important;
  343. }
  344. //button groups
  345. .btn-group {
  346. &:first-child {
  347. margin-left: 0;
  348. }
  349. > .btn {
  350. & , + .btn {
  351. margin: 0 1px 0 0;
  352. }
  353. &:first-child {
  354. margin: 0 1px 0 0;
  355. }
  356. //caret inside buttons
  357. > .caret {
  358. margin-top: 15px;
  359. margin-left: 1px;
  360. border-width: 5px;
  361. border-top-color: #FFF;
  362. }
  363. &.btn-sm > .caret {
  364. margin-top: 10px;
  365. border-width: 4px;
  366. }
  367. &.btn-large > .caret {
  368. margin-top: 18px;
  369. border-width: 6px;
  370. }
  371. &.btn-xs > .caret {
  372. margin-top: 9px;
  373. border-width: 4px;
  374. }
  375. &.btn-minier > .caret {
  376. margin-top: 7px;
  377. border-width: 3px;
  378. }
  379. //dropdown toggle
  380. + .btn.dropdown-toggle {
  381. padding-right: 3px;
  382. padding-left: 3px;
  383. }
  384. + .btn-large.dropdown-toggle {
  385. padding-right: 4px;
  386. padding-left: 4px;
  387. }
  388. }
  389. .dropdown-toggle {
  390. border-radius: 0;
  391. }
  392. .btn-group-active-state(@left, @right, @bottom, @width) {/* the border under an active button in button groups */
  393. &.active:after {
  394. left: unit(@left, px); right:unit(@right, px); bottom:unit(@bottom, px);
  395. border-bottom-width: unit(@width, px);
  396. }
  397. }
  398. > .btn , + .btn{
  399. margin: 0 1px 0 0;
  400. border-width: 3px;// !important;
  401. .btn-group-active-state(-2, -2, -2, 1);
  402. }
  403. > .btn-large , + .btn-large{
  404. border-width: 4px;// !important;
  405. .btn-group-active-state(-3, -3, -3, 1);
  406. }
  407. > .btn-sm , + .btn-sm{
  408. border-width: 2px;// !important;
  409. .btn-group-active-state(-1, -1, -1, 1);
  410. }
  411. > .btn-xs , + .btn-xs{
  412. border-width: 1px;// !important;
  413. .btn-group-active-state(0, 0, 0, 1);
  414. }
  415. > .btn-minier , + .btn-minier{
  416. border-width: 1px;// !important;
  417. .btn-group-active-state(0, 0, 0, 1);
  418. }
  419. }
  420. .btn-group-vertical > .btn:last-child:not(:first-child) {
  421. border-radius: 0;
  422. }
  423. .btn-group > .btn.btn-round {
  424. border-radius: 4px;
  425. }
  426. .btn-group-vertical > .btn , .btn-group-vertical > .btn + .btn {
  427. margin: 1px 0 0 !important;//to override .RTL's
  428. }
  429. .btn-group-vertical > .btn:first-child {
  430. margin-top: 0 !important;//to override .RTL's
  431. }
  432. .btn-group.btn-overlap > .btn {
  433. margin-right: -1px;
  434. }
  435. .btn-group.btn-corner > .btn {
  436. &:first-child {
  437. border-bottom-left-radius: 8px;
  438. border-top-left-radius: 8px;
  439. }
  440. &:last-child {
  441. border-bottom-right-radius: 8px;
  442. border-top-right-radius: 8px;
  443. }
  444. &.btn-sm:first-child {
  445. border-bottom-left-radius: 6px;
  446. border-top-left-radius: 6px;
  447. }
  448. &.btn-sm:last-child {
  449. border-bottom-right-radius: 6px;
  450. border-top-right-radius: 6px;
  451. }
  452. &.btn-xs:first-child {
  453. border-bottom-left-radius: 4px;
  454. border-top-left-radius: 4px;
  455. }
  456. &.btn-xs:last-child {
  457. border-bottom-right-radius: 4px;
  458. border-top-right-radius: 4px;
  459. }
  460. }
  461. .btn.btn-white {
  462. border-width: 1px;
  463. }
  464. .btn.btn-bold {
  465. border-bottom-width: 2px;
  466. }
  467. .btn.btn-round {
  468. border-bottom-width: 2px;
  469. border-radius: 4px !important;
  470. }
  471. //application buttons
  472. .enable_application_buttons() when(@enable-application-buttons = true) {
  473. .btn.btn-app {
  474. display: inline-block;
  475. width: 100px;
  476. font-size: @font-size-btn-app;
  477. font-weight: normal;
  478. color: #FFF;
  479. text-align: center;
  480. text-shadow: 0 -1px -1px rgba(0,0,0,0.2) !important;
  481. border: none;
  482. border-radius: 12px;
  483. padding: 12px 0 8px;
  484. margin: 2px;
  485. line-height: 1.7;
  486. position: relative;
  487. }
  488. //button color
  489. .btn-app-color(@color1, @color2, @percent) {
  490. & , &.no-hover:hover , &.disabled:hover {
  491. background: average(@color1, @color2) !important;
  492. #gradient > .vertical(@color1 , @color2) !important;
  493. }
  494. &:hover {
  495. background: average(darken(@color1,@percent), darken(@color2,@percent)) !important;
  496. #gradient > .vertical(darken(@color1,@percent) , darken(@color2,@percent)) !important;
  497. }
  498. }
  499. .btn-app-color(@color-name, @percent:10%) {
  500. @color1-name : ~`"btn-app-@{color-name}-1"`;
  501. @color2-name : ~`"btn-app-@{color-name}-2"`;
  502. .btn-app-color(@@color1-name, @@color2-name , @percent);
  503. }
  504. .btn-app, .btn-app.btn-default {
  505. .btn-app-color(~"default" , 8%);
  506. }
  507. .btn-app.btn-primary {
  508. .btn-app-color(~"primary");
  509. }
  510. .btn-app.btn-info {
  511. .btn-app-color(~"info");
  512. }
  513. .btn-app.btn-success {
  514. .btn-app-color(~"success");
  515. }
  516. .btn-app.btn-danger {
  517. .btn-app-color(~"danger");
  518. }
  519. .btn-app.btn-warning {
  520. .btn-app-color(~"warning");
  521. }
  522. .btn-app.btn-purple {
  523. .btn-app-color(~"purple");
  524. }
  525. .btn-app.btn-pink {
  526. .btn-app-color(~"pink");
  527. }
  528. .btn-app.btn-inverse {
  529. .btn-app-color(~"inverse");
  530. }
  531. .btn-app.btn-grey {
  532. .btn-app-color(~"grey" , 5%);
  533. }
  534. .btn.btn-app.btn-light {
  535. .btn-app-color(~"light" , 5%);
  536. color: @btn-app-light-color !important;
  537. text-shadow: 0 1px 1px #EEE !important;
  538. }
  539. .btn.btn-app.btn-yellow {
  540. .btn-app-color(~"yellow" , 5%);
  541. color:@btn-app-yellow-color !important;
  542. text-shadow:0 -1px 0 rgba(255, 255, 255, 0.4) !important;
  543. }
  544. .btn.btn-app {
  545. > .@{icon} {
  546. opacity: 0.88;
  547. }
  548. &:hover > .@{icon} {
  549. opacity: 1;
  550. }
  551. &.btn-sm {
  552. width: 80px;
  553. font-size: @font-size-btn-app-sm;
  554. border-radius: 10px;
  555. line-height: 1.5;
  556. }
  557. &.btn-xs {
  558. width: 64px;
  559. font-size: @font-size-btn-app-xs;
  560. border-radius: 8px;
  561. padding-bottom: 7px;
  562. padding-top: 8px;
  563. line-height: 1.45;
  564. }
  565. > .@{icon} {
  566. display: block;
  567. font-size: @font-size-btn-app-icon;
  568. margin: 0 0 4px;
  569. line-height: 36px;
  570. min-width: 0;
  571. padding: 0;
  572. }
  573. &.btn-sm > .@{icon} {
  574. display: block;
  575. font-size: @font-size-btn-app-sm-icon;
  576. line-height: 30px;
  577. margin: 0 0 3px;
  578. }
  579. &.btn-xs > .@{icon} {
  580. display: block;
  581. font-size: @font-size-btn-app-xs-icon;
  582. line-height: 24px;
  583. margin: 0;
  584. }
  585. &.no-radius {
  586. border-radius: 0;
  587. }
  588. &.radius-4 {
  589. border-radius: 4px;
  590. }
  591. //badge & label inside buttons
  592. > .badge , > .label {
  593. position: absolute !important;
  594. top: -2px;
  595. right: -2px;
  596. padding: 1px 3px;
  597. text-align: center;
  598. font-size: @font-size-label-inside-btn-app - 1;
  599. color: #FFF;
  600. &.badge-left , &.label-left{
  601. right: auto;
  602. left: -2px;
  603. }
  604. }
  605. > .label {
  606. padding:1px 6px 3px;
  607. font-size: @font-size-label-inside-btn-app;
  608. }
  609. &.radius-4 , &.no-radius {
  610. > .badge {
  611. border-radius: 3px;
  612. &.no-radius {// > .badge.no-radius
  613. border-radius: 0;
  614. }
  615. }
  616. }
  617. //active state
  618. &.active {
  619. color:@btn-app-active;
  620. &:after {
  621. display: none;
  622. }
  623. &.btn-yellow {
  624. color:@btn-app-yellow-color;
  625. border-color:@btn-app-yellow-border;
  626. }
  627. &.btn-light {
  628. color:@btn-app-light-active;
  629. }
  630. }
  631. }
  632. //////////
  633. //
  634. //ie8 fix needed (ace-ie.css)
  635. .btn-group > .btn-app:first-child:not(:last-child):not(.dropdown-toggle) {
  636. margin-right: 24px;
  637. }
  638. .btn-group > .btn-app + .btn-app.dropdown-toggle {
  639. position: absolute;
  640. width: auto;
  641. height: 100%;
  642. padding-left: 6px;
  643. padding-right: 6px;
  644. margin-left: -23px;
  645. .border-left-radius(0);
  646. right: 0;
  647. }
  648. .btn.btn-app {
  649. &.btn-light, &.btn-yellow {
  650. .box-shadow(~"0 0 0 1px rgba(0, 0, 0, 0.08) inset") !important;
  651. }
  652. }
  653. }
  654. .enable_application_buttons();