dropdowns.less 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. //
  2. // Dropdown menus
  3. // --------------------------------------------------
  4. // Use the .menu class on any <li> element within the topbar or ul.tabs and you'll get some superfancy dropdowns
  5. .dropup,
  6. .dropdown {
  7. position: relative;
  8. }
  9. .dropdown-toggle {
  10. // The caret makes the toggle a bit too tall in IE7
  11. *margin-bottom: -3px;
  12. }
  13. .dropdown-toggle:active,
  14. .open .dropdown-toggle {
  15. outline: 0;
  16. }
  17. // Dropdown arrow/caret
  18. // --------------------
  19. .caret {
  20. display: inline-block;
  21. width: 0;
  22. height: 0;
  23. vertical-align: top;
  24. border-top: 4px solid @black;
  25. border-right: 4px solid transparent;
  26. border-left: 4px solid transparent;
  27. content: "";
  28. }
  29. // Place the caret
  30. .dropdown .caret {
  31. margin-top: 8px;
  32. margin-left: 2px;
  33. }
  34. // The dropdown menu (ul)
  35. // ----------------------
  36. .dropdown-menu {
  37. position: absolute;
  38. top: 100%;
  39. left: 0;
  40. z-index: @zindexDropdown;
  41. display: none; // none by default, but block on "open" of the menu
  42. float: left;
  43. min-width: 160px;
  44. padding: 5px 0;
  45. margin: 2px 0 0; // override default ul
  46. list-style: none;
  47. background-color: @dropdownBackground;
  48. border: 1px solid #ccc; // Fallback for IE7-8
  49. border: 1px solid @dropdownBorder;
  50. // Aligns the dropdown menu to right
  51. &.pull-right {
  52. right: 0;
  53. left: auto;
  54. }
  55. // Dividers (basically an hr) within the dropdown
  56. .divider {
  57. .nav-divider(@dropdownDividerTop, @dropdownDividerBottom);
  58. }
  59. // Links within the dropdown menu
  60. > li > a {
  61. display: block;
  62. padding: 3px 20px;
  63. clear: both;
  64. font-weight: normal;
  65. line-height: @baseLineHeight;
  66. color: @dropdownLinkColor;
  67. white-space: nowrap;
  68. }
  69. }
  70. // Hover/Focus state
  71. // -----------
  72. .dropdown-menu > li > a:hover,
  73. .dropdown-menu > li > a:focus,
  74. .dropdown-submenu:hover > a,
  75. .dropdown-submenu:focus > a {
  76. text-decoration: none;
  77. color: @dropdownLinkColorHover;
  78. background-color: @grafanaListHighlight;
  79. }
  80. // Active state
  81. // ------------
  82. .dropdown-menu > .active > a,
  83. .dropdown-menu > .active > a:hover,
  84. .dropdown-menu > .active > a:focus {
  85. color: @dropdownLinkColorActive;
  86. text-decoration: none;
  87. outline: 0;
  88. background-color: @grafanaListHighlight;
  89. }
  90. // Disabled state
  91. // --------------
  92. // Gray out text and ensure the hover/focus state remains gray
  93. .dropdown-menu > .disabled > a,
  94. .dropdown-menu > .disabled > a:hover,
  95. .dropdown-menu > .disabled > a:focus {
  96. color: @grayLight;
  97. }
  98. // Nuke hover/focus effects
  99. .dropdown-menu > .disabled > a:hover,
  100. .dropdown-menu > .disabled > a:focus {
  101. text-decoration: none;
  102. background-color: transparent;
  103. background-image: none; // Remove CSS gradient
  104. .reset-filter();
  105. cursor: default;
  106. }
  107. // Open state for the dropdown
  108. // ---------------------------
  109. .open {
  110. // IE7's z-index only goes to the nearest positioned ancestor, which would
  111. // make the menu appear below buttons that appeared later on the page
  112. *z-index: @zindexDropdown;
  113. & > .dropdown-menu {
  114. display: block;
  115. }
  116. }
  117. // Backdrop to catch body clicks on mobile, etc.
  118. // ---------------------------
  119. .dropdown-backdrop {
  120. position: fixed;
  121. left: 0;
  122. right: 0;
  123. bottom: 0;
  124. top: 0;
  125. z-index: @zindexDropdown - 10;
  126. }
  127. // Right aligned dropdowns
  128. // ---------------------------
  129. .pull-right > .dropdown-menu {
  130. right: 0;
  131. left: auto;
  132. }
  133. // Allow for dropdowns to go bottom up (aka, dropup-menu)
  134. // ------------------------------------------------------
  135. // Just add .dropup after the standard .dropdown class and you're set, bro.
  136. // TODO: abstract this so that the navbar fixed styles are not placed here?
  137. .dropup,
  138. .navbar-fixed-bottom .dropdown {
  139. // Reverse the caret
  140. .caret {
  141. border-top: 0;
  142. border-bottom: 4px solid @black;
  143. content: "";
  144. }
  145. // Different positioning for bottom up menu
  146. .dropdown-menu {
  147. top: auto;
  148. bottom: 100%;
  149. margin-bottom: 1px;
  150. }
  151. }
  152. // Sub menus
  153. // ---------------------------
  154. .dropdown-submenu {
  155. position: relative;
  156. }
  157. // Default dropdowns
  158. .dropdown-submenu > .dropdown-menu {
  159. top: 0;
  160. left: 100%;
  161. margin-top: -6px;
  162. margin-left: -1px;
  163. .border-radius(0 6px 6px 6px);
  164. }
  165. .dropdown-submenu:hover > .dropdown-menu {
  166. display: block;
  167. }
  168. // Dropups
  169. .dropup .dropdown-submenu > .dropdown-menu {
  170. top: auto;
  171. bottom: 0;
  172. margin-top: 0;
  173. margin-bottom: -2px;
  174. .border-radius(5px 5px 5px 0);
  175. }
  176. // Caret to indicate there is a submenu
  177. .dropdown-submenu > a:after {
  178. display: block;
  179. content: " ";
  180. float: right;
  181. width: 0;
  182. height: 0;
  183. border-color: transparent;
  184. border-style: solid;
  185. border-width: 5px 0 5px 5px;
  186. border-left-color: darken(@dropdownBackground, 20%);
  187. margin-top: 5px;
  188. margin-right: -10px;
  189. }
  190. .dropdown-submenu:hover > a:after {
  191. border-left-color: @dropdownLinkColorHover;
  192. }
  193. // Left aligned submenus
  194. .dropdown-submenu.pull-left {
  195. // Undo the float
  196. // Yes, this is awkward since .pull-left adds a float, but it sticks to our conventions elsewhere.
  197. float: none;
  198. // Positioning the submenu
  199. > .dropdown-menu {
  200. left: -100%;
  201. margin-left: 10px;
  202. .border-radius(6px 0 6px 6px);
  203. }
  204. }
  205. // Tweak nav headers
  206. // -----------------
  207. // Increase padding from 15px to 20px on sides
  208. .dropdown .dropdown-menu .nav-header {
  209. padding-left: 20px;
  210. padding-right: 20px;
  211. }
  212. // Typeahead
  213. // ---------
  214. .typeahead {
  215. z-index: 1051;
  216. margin-top: 2px; // give it some space to breathe
  217. .border-radius(@baseBorderRadius);
  218. }