label-badge.less 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. //labels & badges
  2. .label {
  3. border-radius: 0;
  4. text-shadow: none;
  5. font-weight: normal;
  6. display: inline-block;
  7. background-color: @label-default !important;
  8. &[class*="col-"][class*="arrow"] {
  9. min-height:0;
  10. }
  11. }
  12. @media screen and (-webkit-min-device-pixel-ratio:0) {
  13. //default display:none causes problems with Android Webview
  14. ::safari-only,.label:empty {
  15. display: inline-block;
  16. }
  17. ::safari-only,.badge:empty {
  18. display: inline-block;
  19. }
  20. }
  21. .badge {
  22. text-shadow: none;
  23. font-size: @font-size-badge;
  24. padding-top: 1px;
  25. padding-bottom: 3px;
  26. font-weight: normal;
  27. line-height: 15px;
  28. background-color: @label-default !important;
  29. &.no-radius { border-radius: 0; }
  30. &.radius-1 { border-radius: 1px; }
  31. &.radius-2 { border-radius: 2px; }
  32. &.radius-3 { border-radius: 3px; }
  33. &.radius-4 { border-radius: 4px; }
  34. &.radius-5 { border-radius: 5px; }
  35. &.radius-6 { border-radius: 6px; }
  36. }
  37. .label-transparent, .badge-transparent {
  38. background-color:transparent !important;
  39. }
  40. .enable_label_colors() when(@enable-label-colors = true) {
  41. //labels
  42. .label-color(@color) {
  43. @label-class:~`"label-@{color}"`;
  44. @badge-class:~`"badge-@{color}"`;
  45. @label-color:@@label-class;
  46. .@{label-class}, .@{badge-class} {
  47. background-color:@label-color !important;
  48. }
  49. }
  50. .label-color(~"grey");
  51. .label-color(~"info");
  52. .label-color(~"primary");
  53. .label-color(~"success");
  54. .label-color(~"danger");
  55. .label-color(~"important");
  56. .label-color(~"inverse");
  57. .label-color(~"warning");
  58. .label-color(~"pink");
  59. .label-color(~"purple");
  60. .label-color(~"yellow");
  61. .label-color(~"light");
  62. .badge-yellow, .label-yellow {
  63. color: #996633 !important;
  64. border-color: @label-yellow;
  65. }
  66. .badge-light, .label-light {
  67. color: #888 !important;
  68. }
  69. .label.arrowed , .label.arrowed-in {
  70. position:relative;
  71. z-index: 1;
  72. &:before {
  73. display: inline-block;
  74. content: "";
  75. position: absolute;
  76. top: 0;
  77. z-index: -1;
  78. border: 1px solid transparent;
  79. border-right-color: @label-default;
  80. -moz-border-right-colors: @label-default;
  81. }
  82. }
  83. .label.arrowed-in:before {
  84. border-color: @label-default;
  85. border-left-color: transparent !important;
  86. -moz-border-left-colors: none !important;
  87. }
  88. .label.arrowed-right , .label.arrowed-in-right {
  89. position: relative;
  90. z-index: 1;
  91. &:after {
  92. display: inline-block;
  93. content: "";
  94. position: absolute;
  95. top: 0;
  96. z-index: -1;
  97. border: 1px solid transparent;
  98. border-left-color: @label-default;
  99. -moz-border-left-colors: @label-default;
  100. }
  101. }
  102. .label.arrowed-in-right:after {
  103. border-color: @label-default;
  104. border-right-color: transparent !important;
  105. -moz-border-right-colors: none !important;
  106. }
  107. .label-arrow(@color) {
  108. @label-class:~`"label-@{color}"`;
  109. @label-color:@@label-class;
  110. .@{label-class}{
  111. &.arrowed:before {
  112. border-right-color: @label-color;
  113. -moz-border-right-colors: @label-color;
  114. }
  115. &.arrowed-in:before {
  116. border-color: @label-color;
  117. -moz-border-right-colors: @label-color;
  118. }
  119. &.arrowed-right:after {
  120. border-left-color: @label-color;
  121. -moz-border-left-colors: @label-color;
  122. }
  123. &.arrowed-in-right:after {
  124. border-color: @label-color;
  125. -moz-border-left-colors: @label-color;
  126. }
  127. }
  128. }
  129. .label-arrow(~"info");
  130. .label-arrow(~"primary");
  131. .label-arrow(~"success");
  132. .label-arrow(~"warning");
  133. .label-arrow(~"important");
  134. .label-arrow(~"danger");
  135. .label-arrow(~"inverse");
  136. .label-arrow(~"pink");
  137. .label-arrow(~"purple");
  138. .label-arrow(~"yellow");
  139. .label-arrow(~"light");
  140. .label-arrow(~"grey");
  141. .label {
  142. .label-size(12px, 1.15, 20px, 10px, 5px);
  143. }
  144. .label-lg {
  145. padding:0.3em 0.6em 0.4em;
  146. .label-size(13px, 1.1, 24px, 12px, 6px);
  147. }
  148. .label-xlg {
  149. padding:0.3em 0.7em 0.4em;
  150. .label-size(14px, 1.3, 28px, 14px, 7px);
  151. }
  152. .label-sm {
  153. padding:0.2em 0.4em 0.3em;
  154. .label-size(11px, 1, 18px, 9px, 4px);
  155. }
  156. .label > span , .label > .@{icon} {
  157. line-height: 1;
  158. vertical-align: bottom;
  159. }
  160. .label-size(@font-size, @line-height, @height, @border-height, @border-width) {
  161. font-size: @font-size;
  162. line-height: @line-height;
  163. height: @height;
  164. &.arrowed {
  165. margin-left: @border-width;
  166. &:before {
  167. left: -(@border-width * 2);
  168. border-width: @border-height @border-width;
  169. }
  170. }
  171. &.arrowed-in {
  172. margin-left: (@border-width);
  173. &:before {
  174. left: -@border-width;
  175. border-width: @border-height @border-width;
  176. }
  177. }
  178. &.arrowed-right {
  179. margin-right: @border-width;
  180. &:after {
  181. right: -(@border-width * 2);
  182. border-width: @border-height @border-width;
  183. }
  184. }
  185. &.arrowed-in-right {
  186. margin-right: (@border-width);
  187. &:after {
  188. right: -@border-width;
  189. border-width: @border-height @border-width;
  190. }
  191. }
  192. }
  193. .label:not(.label-lg):not(.label-xlg):not(.label-sm) {
  194. @media
  195. screen and (-webkit-min-device-pixel-ratio: 1.08) and (-webkit-max-device-pixel-ratio: 1.15),
  196. screen and (-webkit-min-device-pixel-ratio: 1.3) and (-webkit-max-device-pixel-ratio: 1.35),
  197. screen and (-webkit-min-device-pixel-ratio: 1.7) and (-webkit-max-device-pixel-ratio: 1.75)
  198. {
  199. &.arrowed:before {
  200. border-width: 10px 6px 11px;
  201. left: -11px;
  202. }
  203. &.arrowed-right:after {
  204. border-width: 10px 6px 11px;
  205. right: -11px;
  206. }
  207. &.arrowed-in:before {
  208. border-width: 10px 5px 10.5px;
  209. left: -6px;
  210. }
  211. &.arrowed-in-right:after {
  212. border-width: 10px 5px 10.5px;
  213. right: -6px;
  214. }
  215. }
  216. @media
  217. screen and (min--moz-device-pixel-ratio: 1.08) and (max--moz-device-pixel-ratio: 1.15),
  218. screen and (min--moz-device-pixel-ratio: 1.3) and (max--moz-device-pixel-ratio: 1.35),
  219. screen and (min--moz-device-pixel-ratio: 1.7) and (max--moz-device-pixel-ratio: 1.75)
  220. {
  221. &.arrowed:before {
  222. border-width: 10px 6px 11px;
  223. left: -11px;
  224. }
  225. &.arrowed-right:after {
  226. border-width: 10px 6px 11px;
  227. right: -11px;
  228. }
  229. &.arrowed-in:before {
  230. border-width: 10px 5px 10.5px;
  231. left: -6px;
  232. }
  233. &.arrowed-in-right:after {
  234. border-width: 10px 5px 10.5px;
  235. right: -6px;
  236. }
  237. }
  238. @media screen and (-webkit-min-device-pixel-ratio: 1.3) and (-webkit-max-device-pixel-ratio: 1.34)
  239. {
  240. &.arrowed:before {
  241. border-width: 10px 6px 11px;
  242. left: -11.5px;
  243. }
  244. &.arrowed-right:after {
  245. border-width: 10px 6px 11px;
  246. right: -11.5px;
  247. }
  248. }
  249. @media screen and (min--moz-device-pixel-ratio: 1.3) and (max--moz-device-pixel-ratio: 1.34)
  250. {
  251. &.arrowed:before {
  252. border-width: 10px 6px 11px;
  253. left: -11.5px;
  254. }
  255. &.arrowed-right:after {
  256. border-width: 10px 6px 11px;
  257. right: -11.5px;
  258. }
  259. }
  260. @media only screen and (-webkit-max-device-pixel-ratio: 1.7) and (-webkit-min-device-pixel-ratio: 1.75)
  261. {
  262. &.arrowed-in:before {
  263. border-width: 10px 5px;
  264. left: -6px;
  265. }
  266. &.arrowed-in-right:after {
  267. border-width: 10px 5px;
  268. right: -6px;
  269. }
  270. }
  271. @media only screen and (min--moz-device-pixel-ratio: 1.7) and (max--moz-device-pixel-ratio: 1.75)
  272. {
  273. &.arrowed-in:before {
  274. border-width: 10px 5px;
  275. left: -6px;
  276. }
  277. &.arrowed-in-right:after {
  278. border-width: 10px 5px;
  279. right: -6px;
  280. }
  281. }
  282. }
  283. }
  284. .enable_label_colors();