labels-badges.less 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 state, but only for links
  35. a {
  36. &.label:hover,
  37. &.badge:hover {
  38. color: @white;
  39. text-decoration: none;
  40. cursor: pointer;
  41. }
  42. }
  43. // Colors
  44. // Only give background-color difference to links (and to simplify, we don't qualifty with `a` but [href] attribute)
  45. .label,
  46. .badge {
  47. // Important (red)
  48. &-important { background-color: @errorText; }
  49. &-important[href] { background-color: darken(@errorText, 10%); }
  50. // Warnings (orange)
  51. &-warning { background-color: @orange; }
  52. &-warning[href] { background-color: darken(@orange, 10%); }
  53. // Success (green)
  54. &-success { background-color: @successText; }
  55. &-success[href] { background-color: darken(@successText, 10%); }
  56. // Info (turquoise)
  57. &-info { background-color: @infoText; }
  58. &-info[href] { background-color: darken(@infoText, 10%); }
  59. // Inverse (black)
  60. &-inverse { background-color: @grayDark; }
  61. &-inverse[href] { background-color: darken(@grayDark, 10%); }
  62. }
  63. // Quick fix for labels/badges in buttons
  64. .btn {
  65. .label,
  66. .badge {
  67. position: relative;
  68. top: -1px;
  69. }
  70. }
  71. .btn-mini {
  72. .label,
  73. .badge {
  74. top: 0;
  75. }
  76. }