1
0

labels-badges.less 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // Labels and badges
  3. // --------------------------------------------------
  4. // Base classes
  5. .label,
  6. .badge {
  7. display: inline-block;
  8. padding: 2px 4px;
  9. font-size: @baseFontSize * .846;
  10. font-weight: bold;
  11. line-height: 14px; // ensure proper line-height if floated
  12. color: @white;
  13. vertical-align: baseline;
  14. white-space: nowrap;
  15. text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  16. background-color: @grayLight;
  17. }
  18. // Set unique padding and border-radii
  19. .label {
  20. .border-radius(3px);
  21. }
  22. .badge {
  23. padding-left: 9px;
  24. padding-right: 9px;
  25. .border-radius(9px);
  26. }
  27. // Empty labels/badges collapse
  28. .label,
  29. .badge {
  30. &:empty {
  31. display: none;
  32. }
  33. }
  34. // Hover/focus state, but only for links
  35. a {
  36. &.label:hover,
  37. &.label:focus,
  38. &.badge:hover,
  39. &.badge:focus {
  40. color: @white;
  41. text-decoration: none;
  42. cursor: pointer;
  43. }
  44. }
  45. // Colors
  46. // Only give background-color difference to links (and to simplify, we don't qualifty with `a` but [href] attribute)
  47. .label,
  48. .badge {
  49. // Important (red)
  50. &-important { background-color: @errorText; }
  51. &-important[href] { background-color: darken(@errorText, 10%); }
  52. // Warnings (orange)
  53. &-warning { background-color: @orange; }
  54. &-warning[href] { background-color: darken(@orange, 10%); }
  55. // Success (green)
  56. &-success { background-color: @successText; }
  57. &-success[href] { background-color: darken(@successText, 10%); }
  58. // Info (turquoise)
  59. &-info { background-color: @infoText; }
  60. &-info[href] { background-color: darken(@infoText, 10%); }
  61. // Inverse (black)
  62. &-inverse { background-color: @grayDark; }
  63. &-inverse[href] { background-color: darken(@grayDark, 10%); }
  64. }
  65. // Quick fix for labels/badges in buttons
  66. .btn {
  67. .label,
  68. .badge {
  69. position: relative;
  70. top: -1px;
  71. }
  72. }
  73. .btn-mini {
  74. .label,
  75. .badge {
  76. top: 0;
  77. }
  78. }